radareorg / radare2

UNIX-like reverse engineering framework and command-line toolset
https://www.radare.org/
GNU Lesser General Public License v3.0
20.68k stars 3k forks source link

Calling izz closes the io fd and breaks subsequent calls #14115

Closed thestr4ng3r closed 5 years ago

thestr4ng3r commented 5 years ago

To reproduce:

r2 -n /bin/ls
> izz
> izz
radare commented 5 years ago

cant repro. works fine here

what shosuld i expect to happen

On 20 May 2019, at 19:13, Florian Märkl notifications@github.com wrote:

To reproduce:

r2 -n /bin/ls

izz izz — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/radare/radare2/issues/14115?email_source=notifications&email_token=AAG75FT2YQWPRG2SIM7WYCDPWLL4VA5CNFSM4HOD4DJ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GUY27AA, or mute the thread https://github.com/notifications/unsubscribe-auth/AAG75FWGRKL3CHSVS37XYRDPWLL4VANCNFSM4HOD4DJQ.

thestr4ng3r commented 5 years ago

Bildschirmfoto vom 2019-05-20 20-37-43 No output in the second call. Seems to even crash on Windows.

radare commented 5 years ago

Maybe related to -n because it works fine when doing r2 /bin/ls for me. Maybe worth add some tests and paste the asan output here

On 20 May 2019, at 20:38, Florian Märkl notifications@github.com wrote:

No output in the second call. Seems to even crash on Windows.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

thestr4ng3r commented 5 years ago

Not just maybe, it is related to -n.

thestr4ng3r commented 5 years ago

As mentioned on Telegram, bin_raw_strings() in cbin.c creates a new RBuffer with r_buf_new_with_io() and then frees it, which closes the fd. Asan says nothing here.

radare commented 5 years ago

thats another regresssion nitroduced in the rbuf refactoring from @ret2libc

On 20 May 2019, at 20:52, Florian Märkl notifications@github.com wrote:

As mentioned on Telegram, bin_raw_strings() in cbin.c creates a new RBuffer with r_buf_new_with_io() and then frees it, which closes the fd. Asan says nothing here.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/radare/radare2/issues/14115?email_source=notifications&email_token=AAG75FTHHA4WCMB6KFNBK3TPWLXQXA5CNFSM4HOD4DJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVZX5PY#issuecomment-494108351, or mute the thread https://github.com/notifications/unsubscribe-auth/AAG75FQW3H5YVHWV3W4VSVLPWLXQXANCNFSM4HOD4DJQ.

a1ext commented 5 years ago

It seems like 3.3 version is affected as well

a1ext commented 5 years ago

I tried izzj instead of izz, after the second one it crashes 100% times on Windows

ret2libc commented 5 years ago

thats another regresssion nitroduced in the rbuf refactoring from @ret2libc

I don't think it was introduced recently, as @a1ext says. But I think we can fix it by changing a bit the RBuffer API. I can work on this.

radare commented 5 years ago

+1

On 21 May 2019, at 10:22, Riccardo Schirone notifications@github.com wrote:

thats another regresssion nitroduced in the rbuf refactoring from @ret2libc https://github.com/ret2libc I don't think it was introduced recently, as @a1ext https://github.com/a1ext says. But I think we can fix it by changing a bit the RBuffer API. I can work on this.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/radare/radare2/issues/14115?email_source=notifications&email_token=AAG75FW4RG7O7YEGXP4Y5I3PWOWNZA5CNFSM4HOD4DJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV3ETIY#issuecomment-494291363, or mute the thread https://github.com/notifications/unsubscribe-auth/AAG75FX452MTTEVBOKEPSCDPWOWNZANCNFSM4HOD4DJQ.