[PATCH] D47204: [WebAssembly] Properly calculate function body offset, and write I32 values.

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 22 13:55:33 PDT 2018


sbc100 added a comment.

In term of the uninitialized memory issue, let me see if I can restate so that we can come to the same understanding.

The code is calling `decodeULEB128(Buf, &Count);` to decode at LEB stored in `Buf` but its ignoring the result.  All it cares about is the number of bytes consumed (`Count`).   As it happens in the original code `Buf` is pointing to uninitialized memory.  It also happens that in the test cases we have `Count` is always expected to be 1 (since the size of the functions we are testing with are < 127 so it only take a one byte LEB to store their length).   So as long as the uninitialized data bytes is between 1 and 127 then the tests will pass.   We could construct a test with larger function body which would probably fail..  but it really depends on the uninitialized data so its only likely to fail  :)   But we should probably as that test anyway I guess?


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D47204





More information about the llvm-commits mailing list