Title: [189097] trunk/Source/WebKit2
- Revision
- 189097
- Author
- mcatanz...@igalia.com
- Date
- 2015-08-28 07:22:57 -0700 (Fri, 28 Aug 2015)
Log Message
Minor fixes in reportUnexpectedSyscall
https://bugs.webkit.org/show_bug.cgi?id=148551
Reviewed by Žan Doberšek.
There is an off-by-one in the static assert.
Also, an unsigned long long is passed in, but the parameter is an int. Then it's passed to
writeUnsignedInt, which takes an unsigned int. Let's use unsigned int instead. (The value
is a syscall number, so it's safe to truncate regardless -- it never be anywhere near as
large as an int, unless the input is malicious, in which case truncating it is the right
thing to do anyway -- so this is just a matter of style.)
* Shared/linux/SeccompFilters/Syscall.cpp:
(WebKit::reportUnexpectedSyscall):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (189096 => 189097)
--- trunk/Source/WebKit2/ChangeLog 2015-08-28 12:58:14 UTC (rev 189096)
+++ trunk/Source/WebKit2/ChangeLog 2015-08-28 14:22:57 UTC (rev 189097)
@@ -1,3 +1,21 @@
+2015-08-28 Michael Catanzaro <mcatanz...@igalia.com>
+
+ Minor fixes in reportUnexpectedSyscall
+ https://bugs.webkit.org/show_bug.cgi?id=148551
+
+ Reviewed by Žan Doberšek.
+
+ There is an off-by-one in the static assert.
+
+ Also, an unsigned long long is passed in, but the parameter is an int. Then it's passed to
+ writeUnsignedInt, which takes an unsigned int. Let's use unsigned int instead. (The value
+ is a syscall number, so it's safe to truncate regardless -- it never be anywhere near as
+ large as an int, unless the input is malicious, in which case truncating it is the right
+ thing to do anyway -- so this is just a matter of style.)
+
+ * Shared/linux/SeccompFilters/Syscall.cpp:
+ (WebKit::reportUnexpectedSyscall):
+
2015-08-28 Carlos Garcia Campos <cgar...@igalia.com>
[GTK] Simplify the internal API to create a WebView
Modified: trunk/Source/WebKit2/Shared/linux/SeccompFilters/Syscall.cpp (189096 => 189097)
--- trunk/Source/WebKit2/Shared/linux/SeccompFilters/Syscall.cpp 2015-08-28 12:58:14 UTC (rev 189096)
+++ trunk/Source/WebKit2/Shared/linux/SeccompFilters/Syscall.cpp 2015-08-28 14:22:57 UTC (rev 189097)
@@ -62,11 +62,13 @@
buf[--width] = '0' + (tens % 10);
}
-static void reportUnexpectedSyscall(int syscall)
+static void reportUnexpectedSyscall(unsigned syscall)
{
char buf[128];
#if defined(__has_builtin) && __has_builtin(__builtin_strlen)
- static_assert(__builtin_strlen(message) + std::numeric_limits<int>::digits10 + 1 < sizeof(buf), "Buffer too small");
+ // Buffer must be big enough for the literal, plus the number of digits in the largest possible
+ // unsigned int, plus one for the newline, plus one more for the trailing null.
+ static_assert(__builtin_strlen(message) + std::numeric_limits<unsigned>::digits10 + 2 < sizeof(buf), "Buffer too small");
#endif
strcpy(buf, message);
writeUnsignedInt(buf + strlen(buf), syscall);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes