Fix overflow that broke remote debugger reopening #15525
Merged
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.
opt->szis initialized withr_buf_sizeatr_bin_open_iousing an io buffer ifr_bin_open_iocan't open a file buffer. Since the debuggers returned unsigned values on lseek(used by io buffers to determine size) to opt->sz which is signed, opt->sz would overflow and contain a negative value, causing r_bin_open_buf to fail.Went ahead and modified SEEK_END values for all debuggers even though this should only affect remote debuggers. ST64_MAX should be enough.
Note: gdbserver worked before the changes if it was on the same machine, tested with gdbserver on a different machine and wingdb.