Bug#906530: dcraw: NULL dereference bug

2018-12-02 Thread Salvatore Bonaccorso
The same issue affects ufraw as well (embedding dcraw).

Regards,
Salvatore



Bug#906530: dcraw: NULL dereference bug

2018-08-17 Thread Jaeseung Choi
Package: dcraw
Version: 9.27-1+b1
Severity: normal

Dear Maintainer,

Running dcraw with the attached poc file raises a NULL dereference bug.

Following gdb log shows the program resulting in segfault.

jason@debian-amd64-stretch:~/report/debian-latest/dcraw$ gdb dcraw -q
Reading symbols from dcraw...(no debugging symbols found)...done.
(gdb) run poc_null
Starting program: /usr/bin/dcraw poc_null
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
poc_null: Unexpected end of file

Program received signal SIGSEGV, Segmentation fault.
0xd01c in ?? ()
(gdb) x/i $rip
=> 0xd01c:  mov%r10w,(%r9,%rax,2)
(gdb) info reg r9 rax
r9 0x0  0
rax0x0  0
(gdb) bt 5
#0  0xd01c in ?? ()
#1  0xb1bc in ?? ()
#2  0x7728f2e1 in __libc_start_main (main=0x9940, argc=2,
argv=0x7fffe638, init=, fini=,
rtld_fini=,
stack_end=0x7fffe628) at ../csu/libc-start.c:291
#3  0xb4da in ?? ()

When we compiled the source with AddressSanitizer, it reports NULL
dereference bug in nokia_load_raw() function as follow.

jason@debian-amd64-stretch:~/report/source-latest/dcraw$ ./dcraw-9.27/dcraw
poc_null
poc_null: Unexpected end of file
ASAN:DEADLYSIGNAL
=
==5981==ERROR: AddressSanitizer: SEGV on unknown address 0x (pc
0x0051301a bp 0x7fffdc70 sp 0x7fffda40 T0)
#0 0x513019 in nokia_load_raw
/home/jason/report/source-latest/dcraw/dcraw-9.27/dcraw.c:1972:28
#1 0x5bcf96 in main
/home/jason/report/source-latest/dcraw/dcraw-9.27/dcraw.c:10150:10
#2 0x76a4f2e0 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
#3 0x41c049 in _start
(/home/jason/report/source-latest/dcraw/dcraw-9.27/dcraw+0x41c049)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV
/home/jason/report/source-latest/dcraw/dcraw-9.27/dcraw.c:1972:28 in
nokia_load_raw
==5981==ABORTING


-- System Information:
Debian Release: 9.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-3-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8),
LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages dcraw depends on:
ii  libc62.24-11+deb9u3
ii  libjpeg62-turbo  1:1.5.1-2
ii  liblcms2-2   2.8-4

dcraw recommends no packages.

Versions of packages dcraw suggests:
pn  gphoto2  
ii  netpbm   2:10.0-15.3+b2

-- no debconf information


poc_null
Description: Binary data