Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Unified Diff: third_party/WebKit/Source/core/xml/XSLTProcessorLibxslt.cpp

Issue 2957933002: Fix another FastMalloc call site with potential integer overflow. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/wtf/allocator/Partitions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/xml/XSLTProcessorLibxslt.cpp
diff --git a/third_party/WebKit/Source/core/xml/XSLTProcessorLibxslt.cpp b/third_party/WebKit/Source/core/xml/XSLTProcessorLibxslt.cpp
index 7a5741905557d3a96df9c4959cb7b34147a61e48..925346675e57a5f8061ed4c3443750f1b30eed63 100644
--- a/third_party/WebKit/Source/core/xml/XSLTProcessorLibxslt.cpp
+++ b/third_party/WebKit/Source/core/xml/XSLTProcessorLibxslt.cpp
@@ -231,9 +231,13 @@ static const char** XsltParamArrayFromParameterMap(
if (parameters.IsEmpty())
return nullptr;
- const char** parameter_array = static_cast<const char**>(
- WTF::Partitions::FastMalloc(((parameters.size() * 2) + 1) * sizeof(char*),
- WTF_HEAP_PROFILER_TYPE_NAME(XSLTProcessor)));
+ WTF::CheckedSizeT size = parameters.size();
Tom Sepez 2017/06/26 22:33:36 Blink is pretty slap-happy about using "unsigned"
+ size *= 2;
+ ++size;
+ size *= sizeof(char*);
+ const char** parameter_array =
+ static_cast<const char**>(WTF::Partitions::FastMalloc(
+ size.ValueOrDie(), WTF_HEAP_PROFILER_TYPE_NAME(XSLTProcessor)));
unsigned index = 0;
for (auto& parameter : parameters) {
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/wtf/allocator/Partitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698