jbig2dec doesn't handle the ubc testsuite file 042_11.jb2. In fact, current HEAD segfaults for me: $ gdb ./jbig2dec [...] (gdb) run ../ubc/042_11.jb2 Starting program: /home/giles/projects/jbig2/jbig2dec/jbig2dec ../ubc/042_11.jb2 Program received signal SIGSEGV, Segmentation fault. 0x000000000040fb41 in jbig2_image_clone (ctx=0x619250, image=0x0) at jbig2_image.c:63 63 image->refcount++; (gdb) bt #0 0x000000000040fb41 in jbig2_image_clone (ctx=0x619250, image=0x0) at jbig2_image.c:63 #1 0x0000000000408131 in jbig2_decode_symbol_dict (ctx=0x619250, segment=0x61a4c0, params=0x7fffffffcbc0, data=0x62879a "@", size=60754, GB_stats=0x0, GR_stats=0x0) at jbig2_symbol_dict.c:714 #2 0x00000000004089b3 in jbig2_symbol_dictionary (ctx=0x619250, segment=0x61a4c0, segment_data=0x628790 "") at jbig2_symbol_dict.c:916 #3 0x000000000040532c in jbig2_parse_segment (ctx=0x619250, segment=0x61a4c0, segment_data=0x628790 "") at jbig2_segment.c:236 #4 0x0000000000404806 in jbig2_data_in (ctx=0x619250, data=0x7fffffffcd90 "\026\b\036\023v\032A4\033a%pC\t\240\330a&\324\020qa8\177}\253\252\247\240BE\034\223\222xB\031\034\202\021\026\020\210\210\212B\"\"!\221\311\b\210\210\213\bDD;h!\304DCh\020a\b\210\350 \301\ba\aHDDDE\202\026\020\210\210\210\210\206\020lDD0\203h&\322\026\341\064\342\"\"\033L\230\342\034D[A\006\020\210hE\204,\020\210\270\210hq\026\020\264\301\b\210\206\230A\204\032`\205\304\064Ћ\b\030B,\216/\033N\305C\tBcb\232b\232i\215\214 \330\240\305\064\305lS\025\024\304&)\246)\215\212b\232i\246\066)\212\016\306\323\033\024\306\301\202Aؓ\034L8D"..., size=4096) at jbig2.c:316 #5 0x00000000004018eb in main (argc=2, argv=0x7fffffffded8) at jbig2dec.c:448
Segfaults get higher priority.
We also segfault on 042_14.jb2, with a very similar backtrace.
The segfault was caused by modification in r11074 (bug 690094). Please see comment 16 in bug 690094.
The regression caused by r11074 was fixed in r11093. 42_11.jb2 stopped segfault, but the resulting image is not correct. The text after line 6 is shifted upward. Changing priority to P4. 042_14.jb2 still segfaults in other code. This already happened in jbig2dec 0.11 (r10691). I will open an another bug for this file.
Remaining problem was caused by Standard Huffman Table K malfunction. b689836_b2.patch in bug 689836 addresses this issue.
This was fixed in r11415.