Title: [245612] trunk/Source/WebCore
- Revision
- 245612
- Author
- [email protected]
- Date
- 2019-05-21 20:05:35 -0700 (Tue, 21 May 2019)
Log Message
WHLSL: Parsing negative int literals parses the positive value instead
https://bugs.webkit.org/show_bug.cgi?id=198096
Reviewed by Dean Jackson.
I also made the code around < INT_MIN a bit easier to follow along with.
No new tests because we haven't imported WHLSL test suite yet.
Verified this works using the AST dumper.
* Modules/webgpu/WHLSL/WHLSLParser.cpp:
(WebCore::WHLSL::intLiteralToInt):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (245611 => 245612)
--- trunk/Source/WebCore/ChangeLog 2019-05-22 02:48:24 UTC (rev 245611)
+++ trunk/Source/WebCore/ChangeLog 2019-05-22 03:05:35 UTC (rev 245612)
@@ -1,3 +1,18 @@
+2019-05-21 Saam barati <[email protected]>
+
+ WHLSL: Parsing negative int literals parses the positive value instead
+ https://bugs.webkit.org/show_bug.cgi?id=198096
+
+ Reviewed by Dean Jackson.
+
+ I also made the code around < INT_MIN a bit easier to follow along with.
+
+ No new tests because we haven't imported WHLSL test suite yet.
+ Verified this works using the AST dumper.
+
+ * Modules/webgpu/WHLSL/WHLSLParser.cpp:
+ (WebCore::WHLSL::intLiteralToInt):
+
2019-05-21 Myles C. Maxfield <[email protected]>
font-optical-sizing applies the wrong variation value
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp (245611 => 245612)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp 2019-05-22 02:48:24 UTC (rev 245611)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp 2019-05-22 03:05:35 UTC (rev 245612)
@@ -230,10 +230,11 @@
return Unexpected<Parser::Error>(Parser::Error(makeString("int literal ", text, " is out of bounds")));
}
if (negate) {
- static_assert(std::numeric_limits<long long int>::min() < std::numeric_limits<int>::min(), "long long needs to be bigger than an int");
- if (static_cast<long long>(result) > std::abs(static_cast<long long>(std::numeric_limits<int>::min())))
+ static_assert(sizeof(int64_t) > sizeof(unsigned) && sizeof(int64_t) > sizeof(int), "This code would be wrong otherwise");
+ int64_t intResult = -static_cast<int64_t>(result);
+ if (intResult < static_cast<int64_t>(std::numeric_limits<int>::min()))
return Unexpected<Parser::Error>(Parser::Error(makeString("int literal ", text, " is out of bounds")));
- return { static_cast<int>(static_cast<long long>(result) * 1) };
+ return { static_cast<int>(intResult) };
}
if (result > static_cast<unsigned>(std::numeric_limits<int>::max()))
return Unexpected<Parser::Error>(Parser::Error(makeString("int literal ", text, " is out of bounds")));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes