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

Unified Diff: runtime/bin/dartutils.cc

Issue 1376973002: Fix for issue 24487951 (heap buffer overflow problem) (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/dartutils.cc
diff --git a/runtime/bin/dartutils.cc b/runtime/bin/dartutils.cc
index a4fc2e2f671117ec2c67178ec70e0c53f2d9fd45..83ffcd35f994e5b5ed2c8a97908e91a960927c50 100644
--- a/runtime/bin/dartutils.cc
+++ b/runtime/bin/dartutils.cc
@@ -464,6 +464,10 @@ const uint8_t* DartUtils::SniffForMagicNumber(const uint8_t* text_buffer,
intptr_t* buffer_len,
bool* is_snapshot) {
intptr_t len = sizeof(magic_number);
+ if (*buffer_len <= len) {
+ *is_snapshot = false;
+ return text_buffer;
+ }
for (intptr_t i = 0; i < len; i++) {
if (text_buffer[i] != magic_number[i]) {
*is_snapshot = false;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698