forked from old/legacy-imlib2
load_pnm: Deal with fread() errors consistently
Was supposed to fixes: ==24603== Invalid read of size 1 ==24603== at 0x1FCD748: __imlib_ScaleAARGB (scale.c:990) ==24603== by 0x1F9BF81: __imlib_RenderImage (rend.c:405) ==24603== by 0x1F0F82C: imlib_render_image_part_on_drawable_at_size (api.c:1886) ==24603== by 0x40CD75: gib_imlib_render_image_part_on_drawable_at_size (gib_imlib.c:231) ==24603== by 0x42C732: winwidget_render_image (winwidget.c:576) ==24603== by 0x417ACA: feh_event_handle_keypress (keyevents.c:598) ==24603== by 0x4190DE: feh_main_iteration (main.c:119) ==24603== by 0x418F45: main (main.c:82) ==24603== Address 0x4824832 is 3,650 bytes inside a block of size 4,096 free'd ==24603== at 0x103E498: free (in /usr/local/lib/valgrind/vgpreload_memcheck-amd64-freebsd.so) ==24603== by 0x234157D: fclose (fclose.c:62) ==24603== by 0x5B3CD7F: load (loader_pnm.c:540) ==24603== by 0x1F7D70F: __imlib_LoadImage (image.c:1041) ==24603== by 0x1F090E4: imlib_load_image_with_error_return (api.c:1299) ==24603== by 0x40F47B: feh_load_image (imlib.c:252) ==24603== by 0x42CA0E: winwidget_loadimage (winwidget.c:753) ==24603== by 0x42C918: winwidget_create_from_file (winwidget.c:126) ==24603== by 0x421869: init_slideshow_mode (slideshow.c:62) ==24603== by 0x418F13: main (main.c:78) when using feh to scale input/queue/id:000407,src:000226,op:havoc,rep:32 but isn't sufficient by itself. Still looks correct to me, though.
This commit is contained in:
parent
143f2993d7
commit
b0a42f8763
|
@ -373,7 +373,7 @@ load(ImlibImage * im, ImlibProgressFunction progress,
|
|||
for (y = 0; y < h; y++)
|
||||
{
|
||||
if (!fread(data, w * 1, 1, f))
|
||||
break;
|
||||
goto quit_error;
|
||||
|
||||
ptr = data;
|
||||
if (v == 0 || v == 255)
|
||||
|
@ -415,7 +415,7 @@ load(ImlibImage * im, ImlibProgressFunction progress,
|
|||
for (y = 0; y < h; y++)
|
||||
{
|
||||
if (!fread(data, w * 3, 1, f))
|
||||
break;
|
||||
goto quit_error;
|
||||
|
||||
ptr = data;
|
||||
if (v == 0 || v == 255)
|
||||
|
@ -457,7 +457,7 @@ load(ImlibImage * im, ImlibProgressFunction progress,
|
|||
for (y = 0; y < h; y++)
|
||||
{
|
||||
if (!fread(data, w * 1, 1, f))
|
||||
break;
|
||||
goto quit_error;
|
||||
|
||||
ptr = data;
|
||||
for (x = 0; x < w; x++)
|
||||
|
@ -490,7 +490,7 @@ load(ImlibImage * im, ImlibProgressFunction progress,
|
|||
for (y = 0; y < h; y++)
|
||||
{
|
||||
if (!fread(data, w * 4, 1, f))
|
||||
break;
|
||||
goto quit_error;
|
||||
|
||||
ptr = data;
|
||||
if (v == 0 || v == 255)
|
||||
|
|
Loading…
Reference in New Issue