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

Unified Diff: src/wasm/ast-decoder.h

Issue 2285643002: [wasm] Validate the alignment of load and store instructions. (Closed)
Patch Set: Comments Created 4 years, 4 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 | src/wasm/ast-decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/ast-decoder.h
diff --git a/src/wasm/ast-decoder.h b/src/wasm/ast-decoder.h
index 22ae789c1b42dfd9c57bb81f519b0a08b6cf88fc..f653d1de6ff07c66237f179173868464cd9cf77e 100644
--- a/src/wasm/ast-decoder.h
+++ b/src/wasm/ast-decoder.h
@@ -185,10 +185,15 @@ struct MemoryAccessOperand {
uint32_t alignment;
uint32_t offset;
unsigned length;
- inline MemoryAccessOperand(Decoder* decoder, const byte* pc) {
+ inline MemoryAccessOperand(Decoder* decoder, const byte* pc,
+ uint32_t max_alignment) {
unsigned alignment_length;
alignment =
decoder->checked_read_u32v(pc, 1, &alignment_length, "alignment");
+ if (max_alignment < alignment) {
+ decoder->error(pc,
titzer 2016/09/02 07:46:23 How about printing the expected maximum and the ac
ahaas 2016/09/02 11:35:45 Done.
+ "alignment must be less or equal to natural alignment");
+ }
unsigned offset_length;
offset = decoder->checked_read_u32v(pc, 1 + alignment_length,
&offset_length, "offset");
« no previous file with comments | « no previous file | src/wasm/ast-decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698