Title: [250380] trunk/Source/WTF
- Revision
- 250380
- Author
- [email protected]
- Date
- 2019-09-25 23:41:14 -0700 (Wed, 25 Sep 2019)
Log Message
Address static analysis warning in UTextProviderLatin1.cpp: Array access results in a null pointer dereference
https://bugs.webkit.org/show_bug.cgi?id=202155
<rdar://problem/55672422>
Reviewed by Geoffrey Garen.
Xcode's static analysis reports:
.../OpenSource/Source/WTF/wtf/text/icu/UTextProviderLatin1.cpp:185:22: warning: Array access (from variable 'dest') results in a null pointer dereference
dest[length] = 0;
~~~~ ^
This error is due to an earlier "if" statement that caused the static
analyzer to infer that "dest" could be NULL. It turns out that that
previous check was in error, in that it tested for "!dest" when it
should have tested for "dest". So this patch fixes that.
Even with that error fixed, the static analyzer will still infer that
"dest" could be NULL at the point shown above. Therefore, add a "dest"
test just before the assignment.
* wtf/text/icu/UTextProviderLatin1.cpp:
(WTF::uTextLatin1Extract):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (250379 => 250380)
--- trunk/Source/WTF/ChangeLog 2019-09-26 05:32:00 UTC (rev 250379)
+++ trunk/Source/WTF/ChangeLog 2019-09-26 06:41:14 UTC (rev 250380)
@@ -1,3 +1,29 @@
+2019-09-25 Keith Rollin <[email protected]>
+
+ Address static analysis warning in UTextProviderLatin1.cpp: Array access results in a null pointer dereference
+ https://bugs.webkit.org/show_bug.cgi?id=202155
+ <rdar://problem/55672422>
+
+ Reviewed by Geoffrey Garen.
+
+ Xcode's static analysis reports:
+
+ .../OpenSource/Source/WTF/wtf/text/icu/UTextProviderLatin1.cpp:185:22: warning: Array access (from variable 'dest') results in a null pointer dereference
+ dest[length] = 0;
+ ~~~~ ^
+
+ This error is due to an earlier "if" statement that caused the static
+ analyzer to infer that "dest" could be NULL. It turns out that that
+ previous check was in error, in that it tested for "!dest" when it
+ should have tested for "dest". So this patch fixes that.
+
+ Even with that error fixed, the static analyzer will still infer that
+ "dest" could be NULL at the point shown above. Therefore, add a "dest"
+ test just before the assignment.
+
+ * wtf/text/icu/UTextProviderLatin1.cpp:
+ (WTF::uTextLatin1Extract):
+
2019-09-25 Wenson Hsieh <[email protected]>
[iPadOS] [DataActivation] Focus moves away after focusing input fields on www.att.com
Modified: trunk/Source/WTF/wtf/text/icu/UTextProviderLatin1.cpp (250379 => 250380)
--- trunk/Source/WTF/wtf/text/icu/UTextProviderLatin1.cpp 2019-09-26 05:32:00 UTC (rev 250379)
+++ trunk/Source/WTF/wtf/text/icu/UTextProviderLatin1.cpp 2019-09-26 06:41:14 UTC (rev 250380)
@@ -173,7 +173,7 @@
if (!length)
return 0;
- if (destCapacity > 0 && !dest) {
+ if (dest) {
int32_t trimmedLength = static_cast<int32_t>(length);
if (trimmedLength > destCapacity)
trimmedLength = destCapacity;
@@ -182,7 +182,8 @@
}
if (length < destCapacity) {
- dest[length] = 0;
+ if (dest)
+ dest[length] = 0;
if (*status == U_STRING_NOT_TERMINATED_WARNING)
*status = U_ZERO_ERROR;
} else if (length == destCapacity)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes