This will handle those platforms that don't have 8-bit chars.
This is a follow up fix to review D41384, which has been committed since.
Details
- Reviewers
dcoughlin xazax.hun NoQ george.karpenkov
Diff Detail
Event Timeline
lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp | ||
---|---|---|
517 | I suggest not using auto here, because it makes it harder to understand integer promotions (potential overflows or sign extensions) in the comparison. |
lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp | ||
---|---|---|
517 | That's true. Should it be CharUnits::QuantityType then? |
Sorry, i completely forgot about this one :(
I think this patch needs lit tests, eg. tell the analyzer to analyze a simple strcpy() call on any -target with non-8-bit chars and see if it's still crashes or behaves incorrectly.
lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp | ||
---|---|---|
517 | I think you should still getQuantity(), and then explicitly cast it to a type that's compatible with String->getLength(), so that there were no implicit integer casts around >=. |
I suggest not using auto here, because it makes it harder to understand integer promotions (potential overflows or sign extensions) in the comparison.