Bug 1944099

Summary: bmptopnm converts bmp file with heap-buffer-overflow.
Product: [Fedora] Fedora Reporter: 1259920914
Component: netpbmAssignee: Josef Ridky <jridky>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 35CC: jridky, phracek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-12-13 15:20:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
poc file to this bug none

Description 1259920914 2021-03-29 09:45:44 UTC
Created attachment 1767291 [details]
poc file to this bug

Created attachment 1767291 [details]
poc file to this bug

Description of problem:
A heap-buffer-overflow problem in netpbm bmptopnm.

Version-Release number of selected component (if applicable):
svn revision: 4078

How reproducible:
First install requirements for netpbm:
svn checkout http://svn.code.sf.net/p/netpbm/code/advanced netpbm
cd to netpbm, ./configure choose static. Then open config.mk, add "-g and -fsanitize=address" to CFLAGS and "LDFLAGS = -fsanitize=address" to the file.
Then make. 

Steps to Reproduce:
[path to the file]/bmptopnm c3

Actual results:
./bin/bmptopnm /mnt/disk/out/netpbm_bmptopnm/c3
bmptopnm: Windows (v4) BMP, 1073741827x1x16
bmptopnm: warning: some image data remains unread.
bmptopnm: WRITING PPM IMAGE
P6
1073741827 1
255
=================================================================
==910==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000efe1 at pc 0x0000004068aa bp 0x7ffcb9962d20 sp 0x7ffcb9962d10
READ of size 1 at 0x60200000efe1 thread T0
    #0 0x4068a9  (/usr/local/netpbm_asan/bin/bmptopnm+0x4068a9)
    #1 0x7f11797c583f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2083f)
    #2 0x406bd8  (/usr/local/netpbm_asan/bin/bmptopnm+0x406bd8)

0x60200000efe1 is located 1 bytes to the right of 16-byte region [0x60200000efd0,0x60200000efe0)
allocated by thread T0 here:
    #0 0x7f1179f10602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x402e5d  (/usr/local/netpbm_asan/bin/bmptopnm+0x402e5d)

SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 ??
Shadow bytes around the buggy address:
  0x0c047fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9db0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9dc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9dd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9de0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff9df0: fa fa fa fa fa fa fa fa fa fa 00 00[fa]fa 00 04
  0x0c047fff9e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
==910==ABORTING


Additional info:

credit: jimoyong from NSFOCUS Security Team

Comment 1 Ben Cotton 2021-08-10 12:57:26 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 35 development cycle.
Changing version to 35.

Comment 2 Ben Cotton 2022-11-29 16:54:39 UTC
This message is a reminder that Fedora Linux 35 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 35 on 2022-12-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '35'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 35 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 3 Ben Cotton 2022-12-13 15:20:31 UTC
Fedora Linux 35 entered end-of-life (EOL) status on 2022-12-13.

Fedora Linux 35 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.