Re: [PATCH] Prevent jumping beyond file end in the viewer



Hello Andrzej,

On Wed, 20 Dec 2006, andrzej zaborowski wrote:

in the hex viewer the GoTo (F5) command allows you to jump beyond
end of file and even to view or edit data there. This is because the
address given by user is not checked for correctness anywhere.
Eventually, in src/view.c:view_file_load_data, the address is passed
to lseek() whose return value is checked, but it turns out lseek'ing
beyond end of file is legal and not an error. This immediately results
in Bad Things (tm) like at the return from view_file_load_data the
ds_file_datalen is actually negative. Attached diff fixes this.

Thanks for your bugreport! I won't apply your patch though but
a slightly modified one. I won't the viewer to display a warning
box, reading something like "Invalid offset" or something, instead
of just doing nothing. I'll let you know when I commit the patch.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]