Skip to content

Commit

Permalink
Add UTF8String to the banned method list.
Browse files Browse the repository at this point in the history
NSString's UTF8String can return null for some NSStrings, even if
|canBeConvertedToEncoding:NSUTF8StringEncoding| returns YES.
This has led to at least 2 crashes that were not encountered during
the development period.

BUG=659649, 656108, 653379

Review-Url: https://codereview.chromium.org/2450033004
Cr-Commit-Position: refs/heads/master@{#427991}
  • Loading branch information
jif authored and Commit bot committed Oct 27, 2016
1 parent cfc2c3b commit 6539870
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@
),
True,
),
(
r"/\s+UTF8String\s*]",
(
'The use of -[NSString UTF8String] is dangerous as it can return null',
'even if |canBeConvertedToEncoding:NSUTF8StringEncoding| returns YES.',
'Please use |SysNSStringToUTF8| instead.',
),
True,
),
)


Expand Down

0 comments on commit 6539870

Please sign in to comment.