apply_matrix on empty image may trigger core dump
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=3456
Reported by Martin Nilsson, IDA nilsson@pike.ida.liu.se
The following code
object fn = Image.Fonts.Font( "font.ttf", 61 );
Image.Image i = fn->write("\30240");
i->apply_matrix( ({ ({1,2,1}), ({2,5,2}), ({1,2,1}) }) );
using the font.ttf in aido/fonts generates a segmentation fault.
0x4012e23b in chunk_free (ar_ptr=0x401dfc80, p=0x8362191) at malloc.c:3228
3228 malloc.c: No such file or directory.
in malloc.c
(gdb) bt
#0 0x4012e23b in chunk_free (ar_ptr=0x401dfc80, p=0x8362191) at malloc.c:3228
#1 0x4012dfc0 in __libc_free (mem=0x83621a0) at malloc.c:3154
#2 0x403c5d5a in exit_image_struct (obj=0x846ae88)
at /home/nilsson/Pike/7.5/src/modules/Image/image.c:192
#3 0x080fee34 in compat_event_handler (e=1)
at /home/nilsson/Pike/7.5/src/program.c:2938
#4 0x080e25d5 in destruct (o=0x846ae88)
at /home/nilsson/Pike/7.5/src/object.c:763
#5 0x080e2814 in low_destruct_objects_to_destruct ()
at /home/nilsson/Pike/7.5/src/object.c:878
#6 0x08074e35 in low_return () at /home/nilsson/Pike/7.5/src/interpret.c:1619
#7 0x08070816 in opcode_F_RETURN_0 ()
at /home/nilsson/Pike/7.5/src/interpret_functions.h:1412
#8 0x0832b6a0 in ?? ()
#9 0x0807524c in o_catch (pc=0x83791cc "¡\020¬#\b\203@\034\022Ç\004$#")
at /home/nilsson/Pike/7.5/src/interpret.c:1749
#10 0x0806f9c2 in opcode_F_CATCH ()
at /home/nilsson/Pike/7.5/src/interpret_functions.h:1212
#11 0x083791c8 in ?? ()
#12 0x08075170 in mega_apply (type=APPLY_LOW, args=2, arg1=0x82ca6ec,
arg2=0x58) at /home/nilsson/Pike/7.5/src/interpret.c:1704
#13 0x08075c77 in apply (o=0x82ca6ec, fun=0x81c0c37 "_main", args=2)
at /home/nilsson/Pike/7.5/src/interpret.c:2020
#14 0x080d9593 in main (argc=4, argv=0xbffffa74)
at /home/nilsson/Pike/7.5/src/main.c:760
#15 0x400cd336 in __libc_start_main (main=0x80d8bc0 <main>, argc=4,
ubp_av=0xbffffa74, init=0x80622b8 <_init>, fini=0x819ee50 <_fini>,
rtld_fini=0x4000d2fc <_dl_fini>, stack_end=0xbffffa6c)
at ../sysdeps/generic/libc-start.c:129