Re: [PATCH] Prevent jumping beyond file end in the viewer
- From: Pavel Tsekov <ptsekov gmx net>
- To: balrogg gmail com
- Cc: mc-devel gnome org
- Subject: Re: [PATCH] Prevent jumping beyond file end in the viewer
- Date: Wed, 20 Dec 2006 13:50:49 +0200 (EET)
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.
] [Thread Prev