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

Side by Side Diff: src/snapshot/code-serializer.cc

Issue 2418483002: [wasm] test deserialization when header is invalid (Closed)
Patch Set: test method to alter header Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « src/snapshot/code-serializer.h ('k') | src/snapshot/serializer-common.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/snapshot/code-serializer.h" 5 #include "src/snapshot/code-serializer.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/log.h" 10 #include "src/log.h"
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 DisallowHeapAllocation no_gc; 408 DisallowHeapAllocation no_gc;
409 SerializedCodeData scd(cached_data); 409 SerializedCodeData scd(cached_data);
410 *rejection_result = scd.SanityCheck(isolate, expected_source_hash); 410 *rejection_result = scd.SanityCheck(isolate, expected_source_hash);
411 if (*rejection_result != CHECK_SUCCESS) { 411 if (*rejection_result != CHECK_SUCCESS) {
412 cached_data->Reject(); 412 cached_data->Reject();
413 return SerializedCodeData(nullptr, 0); 413 return SerializedCodeData(nullptr, 0);
414 } 414 }
415 return scd; 415 return scd;
416 } 416 }
417 417
418 void SerializedCodeData::InvalidateVersionForTest(byte* buffer,
Yang 2016/10/13 06:52:59 I'm not really happy with introducing test APIs. C
Mircea Trofin 2016/10/13 16:09:10 The former is more complicated, because the field
419 size_t buffer_size) {
420 DCHECK_GE(buffer_size, static_cast<size_t>(kVersionHashOffset + kInt32Size));
421 uint32_t expected_version_hash = Version::Hash();
422 uint32_t invalid_version_hash = expected_version_hash + 1;
423 SerializedData::SetHeaderValueInBuffer(buffer, kVersionHashOffset,
424 invalid_version_hash);
425 }
426
418 } // namespace internal 427 } // namespace internal
419 } // namespace v8 428 } // namespace v8
OLDNEW
« no previous file with comments | « src/snapshot/code-serializer.h ('k') | src/snapshot/serializer-common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698