OSDN Git Service

Fix processing of local variable indices in fuction blocks.
authorKarl Schimpf <kschimpf@google.com>
Mon, 10 Aug 2015 18:12:56 +0000 (11:12 -0700)
committerKarl Schimpf <kschimpf@google.com>
Mon, 10 Aug 2015 18:12:56 +0000 (11:12 -0700)
commitc6acf08fae334eeade1577853a471e33cb05bc25
treee25778aa570ca487329d131bb0d8371c2c54e5c5
parent86ebec12680b5268fcb7082f770a26394e8b8080
Fix processing of local variable indices in fuction blocks.

The previous code used a vector to hold local values associated with
indices in the bitcode file. The problem was that the vector would be
expanded to match the index of a "variable index forward reference".
If the index was very large, the program would freeze the computer
trying to allocate an array large enough to contain the index.

This patch fixes this by using a local unordered map instead of a
vector.  Hence, forward index references just add a sinle entry into
the map.

Note that this fix doesn't have a corresponding issue. However, the
problem was made apparent from the problems noted in issues 4257 and
4261.

BUG=None
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1282523002 .
src/PNaClTranslator.cpp