Bug 2228923

Summary: Buffer Overflow Error attempting to generate a datamatrix png
Product: [Fedora] Fedora Reporter: Beau V.C. Bellamy <bellamy.beau>
Component: dmtx-utilsAssignee: Dan Horák <dan>
Status: ASSIGNED --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 38CC: dan
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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
GDB Backtrace
none
Proposed patch to fix buffer overflow none

Description Beau V.C. Bellamy 2023-08-03 16:00:07 UTC
Created attachment 1981494 [details]
GDB Backtrace

Description of problem:
Attempting to generate a datamatrix with the dmtxwrite utility results in a buffer overflow error and termination.

Version-Release number of selected component (if applicable):
0.7.6-14.fc38

How reproducible:
[user@fedora38 ~]# cat /etc/fedora-release | dmtxwrite -o release.png
*** buffer overflow detected ***: terminated
Aborted (core dumped)


Actual results:
Crash

Expected results:
release.png image created

Additional info:
backtrace attached

Comment 1 Beau V.C. Bellamy 2023-08-04 01:08:28 UTC
Created attachment 1981565 [details]
Proposed patch to fix buffer overflow

Comment 2 Beau V.C. Bellamy 2023-08-04 01:14:11 UTC
dmtxwrite appears completely broken when _FORTIFY_SOURCE=3 is used.  The attached patch attempts to fix the source.

Comment 3 Dan Horák 2023-08-04 07:50:54 UTC
Thanks, seems _FORTIFY_SOURCE=3 is doing its work. Could you open an upstream PR (https://github.com/dmtx/dmtx-utils/pulls) as well so I can I refer it in the package?

Comment 4 Beau V.C. Bellamy 2023-08-05 22:39:07 UTC
Upstream pull request is here: [https://github.com/dmtx/dmtx-utils/pull/16](https://github.com/dmtx/dmtx-utils/pull/16)