| 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;
|
|
|