LATX, fix: Avoid invalid IR1 predecessor access - #338
Draft
LaurenIsACoder wants to merge 1 commit into
Draft
Conversation
QCefViewTest can reach the decode limit before producing an IR1 instruction. Do not form ir1_list[-1] in that case; only derive the next address from a predecessor after confirming one exists. Signed-off-by: Wenqiang Wei <weiwenqiang@mail.ustc.edu.cn>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ir1_list[-1]when disassembly fails before producing thefirst IR1 instruction.
after confirming that one exists.
Root cause
The failure path formed a pointer to
ir1_list[ir1_num - 1]before checkingwhether
ir1_numwas zero. A decode failure on the first instruction thereforeformed an out-of-bounds predecessor pointer even though the zero-instruction
branch did not dereference it.
Validation
Mac:
reported 6 errors.
git diff --checkpasses.LoongArch (
l1, commitc91ac892ce776d26c2c97fd35c479d5dca1fc16e):libqemu-x86_64-linux-user.fa.p/target_i386_latx_translator_translate.c.opasses.
ninja -C build latx-x86_64 -j8passes.ninja -C build -j8passes.meson test -C build --no-rebuild --print-errorlogs: 4/4 tests pass.Signed-off-by: Wenqiang Wei weiwenqiang@mail.ustc.edu.cn