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: Sat, 30 Dec 2006 15:20:52 +0200
Hello Andrzej,
On Wed, 2006-12-20 at 13:50, Pavel Tsekov wrote:
> 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.
I've commited a slightly modified version of your patch -
view_file_load_data() doesn't trash the buffer contents if
an invalid offset is specified. I think it's better this
way but it might changed in the future. I also added a
dialog box to display a warning message if an invalid offset
was specified.
Thanks!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]