#968961 jhead: invalid read in Get16u

Package:
jhead
Source:
jhead
Description:
manipulate the non-image part of Exif compliant JPEG files
Submitter:
Luca Borzacchiello
Date:
2021-12-22 11:09:02 UTC
Severity:
normal
Tags:
#968961#5
Date:
2020-08-24 16:26:10 UTC
From:
To:
Dear Maintainer,
running jhead with the attached file leads to an invalid read in Get16u.

command line:
jhead ./00_invalid_read_get16u

valgrind output:
[...]
==6799== Invalid read of size 2
==6799==    at 0x111528: Get16u (exif.c:323)
==6799==    by 0x111528: process_EXIF (exif.c:1022)
==6799==    by 0x10E882: ReadJpegSections (jpgfile.c:287)
==6799==    by 0x10E882: ReadJpegSections (jpgfile.c:119)
==6799==    by 0x10EA12: ReadJpegFile (jpgfile.c:379)
==6799==    by 0x10CAF7: ProcessFile (jhead.c:905)
==6799==    by 0x10B70B: main (jhead.c:1756)
==6799==  Address 0x4b588aa is 0 bytes after a block of size 10 alloc'd
==6799==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==6799==    by 0x10E31A: ReadJpegSections (jpgfile.c:173)
==6799==    by 0x10E31A: ReadJpegSections (jpgfile.c:119)
==6799==    by 0x10EA12: ReadJpegFile (jpgfile.c:379)
==6799==    by 0x10CAF7: ProcessFile (jhead.c:905)
==6799==    by 0x10B70B: main (jhead.c:1756)
==6799==
[...]