This is an archive of the discontinued LLVM Phabricator instance.

WebAssembly: Never write more than 32-bits for WebAssembly::OPERAND_OFFSET32
ClosedPublic

Authored by sbc100 on Apr 4 2018, 12:32 PM.

Details

Summary

A bug was found where an offset of -1 would generate an encoding
of max int64 which is invalid in the binary format.

Diff Detail

Repository
rL LLVM

Event Timeline

sbc100 created this revision.Apr 4 2018, 12:32 PM
sbc100 updated this revision to Diff 141023.Apr 4 2018, 12:33 PM

update test

sbc100 updated this revision to Diff 141024.Apr 4 2018, 12:34 PM

remove debugging

jgravelle-google accepted this revision.Apr 4 2018, 12:38 PM
This revision is now accepted and ready to land.Apr 4 2018, 12:38 PM
sbc100 updated this revision to Diff 141025.Apr 4 2018, 12:40 PM
  • update test
dschuff accepted this revision.Apr 4 2018, 1:01 PM

LGTM for the encoding... I hope the -1 offset wasn't being generated by the compiler though?

sbc100 added a comment.EditedApr 4 2018, 1:46 PM

LGTM for the encoding... I hope the -1 offset wasn't being generated by the compiler though?

It does come from the compiler:

void _start(void) {
  char *oob = (char *) -1; *oob = 0;
}
This revision was automatically updated to reflect the committed changes.