Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix removeZeroSequences #1110

Merged
merged 1 commit into from
Nov 7, 2022
Merged

Fix removeZeroSequences #1110

merged 1 commit into from
Nov 7, 2022

Conversation

neverwin
Copy link
Contributor

Please review.

@PeterMatula
Copy link
Collaborator

Thanks for the improvement. It looks like regression tests do not mind -- no test failed. However, before I merge this, would you be able to provide an example in which this change helped? I guess you have a reason for the change and it would be ideal to test the improvement in our test suite. If this has an effect on some tests in our regression tests, all the better. I could just add another check to an already existing test case.

@neverwin
Copy link
Contributor Author

This improves decoding for some binary. Here's a minimal example:

b label
.skip 0x100
label: lui $sp, 0x1000
llvm-mc -arch mipsel -filetype=obj bug.s -o bug.o
retdec-decompiler bug.o

@neverwin
Copy link
Contributor Author

Buggy Result:

0x0:     41 00 00 10   	b 0x108
0x4:     00 00 00 00   	nop 
; data inside code section at 0x8 -- 0x10c
0x8:     00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x18:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x28:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x38:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x48:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x58:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x68:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x78:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x88:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x98:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0xa8:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0xb8:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0xc8:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0xd8:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0xe8:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0xf8:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x108:   00 10 1d 3c                                        |...<            |

Correct Result:

0x0:     41 00 00 10   	b 0x108 <function_0+0x108>
0x4:     00 00 00 00   	nop 
; data inside code section at 0x8 -- 0x108
0x8:     00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x18:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x28:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x38:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x48:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x58:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x68:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x78:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x88:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x98:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0xa8:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0xb8:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0xc8:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0xd8:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0xe8:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0xf8:    00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |................|
0x108:   00 10 1d 3c   	lui $sp, 0x1000

@PeterMatula PeterMatula merged commit 394e12b into avast:master Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants