[SRU] binhex always segfaults

Bug #1892558 reported by Nathaniel Beaver
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
macutils (Ubuntu)
Fix Released
Undecided
Unassigned
Focal
Fix Committed
Undecided
Sudip Mukherjee

Bug Description

[ Impact ]

some of the binaries provided by macutils are completely unusable as they will immediately segfault as soon as they are executed.
The impacted binaries are:
binhex
tomac
frommac

This is because the relevant header file was not included and so as as result the compiler assumed the functions return an integer.

[ Test Plan ]

1. Install macutils
2. Execute all the binaries provided by macutils for a basic sanity test

binhex -H
frommac -H
hexbin -H
macsave -H
macstream -H
macunpack -H
tomac -H

If the package is not fixed then binhex, tomac and frommac will result in segfault.

[ Where problems could occur ]

There is no change in code, only the relevant header file has been included. And, so there are minimum chances of a regression. The change has been part of Debian and also Jammy onwards and there has been no regression reported.

[ Other Info ]

The testplan only does a basic sanity test. Ideally a macutils user should test and confirm that everything is working as expected.

[ Original Bug Description ]

Steps to reproduce:

binhex -H

Expected result: binhex prints help information

Actual result: binhex crashes with SIGSEGV

Comments: binhex doesn't only crash with the -H flag, it crashes with any flag. It appears to crash in the main() function before any argument handling actually happens.

Version is 2.0b3-16build1.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: macutils 2.0b3-16build1
ProcVersionSignature: Ubuntu 5.4.0-42.46~18.04.1-generic 5.4.44
Uname: Linux 5.4.0-42-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.16
Architecture: amd64
CurrentDesktop: KDE
Date: Fri Aug 21 20:57:56 2020
Dependencies:
 gcc-8-base 8.4.0-1ubuntu1~18.04
 libc6 2.27-3ubuntu1.2
 libgcc1 1:8.4.0-1ubuntu1~18.04
InstallationDate: Installed on 2020-02-01 (202 days ago)
InstallationMedia: Ubuntu 18.04.2 LTS "Bionic Beaver" - Release amd64 (20190210)
SourcePackage: macutils
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Nathaniel Beaver (nathanielmbeaver) wrote :
Revision history for this message
Nathaniel Beaver (nathanielmbeaver) wrote :

Stack trace.

Revision history for this message
Nathaniel Beaver (nathanielmbeaver) wrote :

Note: the frommac and tomac commands use similar argument handling code and so also segfault in the same way.

Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :

I have now tested and can reproduce the issue on Focal. Also tested and confirmed that Jammy and Mantic are not affected.

Changed in macutils (Ubuntu):
status: New → Confirmed
Changed in macutils (Ubuntu Focal):
status: New → In Progress
assignee: nobody → Sudip Mukherjee (sudipmuk)
Changed in macutils (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :

debdiff attached.

summary: - binhex always segfaults
+ [SRU] binhex always segfaults
description: updated
Changed in macutils (Ubuntu Focal):
status: In Progress → Confirmed
assignee: Sudip Mukherjee (sudipmuk) → nobody
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thank you for the patch.

Uploaded to Focal.

Changed in macutils (Ubuntu Focal):
status: Confirmed → In Progress
assignee: nobody → Sudip Mukherjee (sudipmuk)
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Hi Sudip,

Thanks for debugging, backporting, and submitting a patch!
Nice touch on the DEP-3 headers.

Just a style/cosmetic _suggestion_ that is helpful: in the
future, please list the .patch file in d/changelog; e.g.,
'* d/p/fix-segfault.patch: Fix segfault with binhex, frommac and tomac. (LP: #1892558)'

And just for documentation purposes:
> There is no change in code, only the relevant header file has been included.
> And, so there are minimum chances of a regression.

The inclusion of a header file even 'without code changes'
may actually cause code changes _indirectly_. For example,
a header file defines a macro that is checked in the source
file (to change code paths) with a preprocessor #if/#ifdef.

This is _not_ the case here, as the included headers only
define the function prototypes, and nothing else/no macro;
so it looks good!

I also confirmed that the newer releases have the change
and are not affected.

Accepting macutils to focal-proposed.
Thanks again!

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

$ lsb_release -cs; dpkg -s macutils | grep ^Version:; dpkg -L macutils | grep /bin/ | while read BIN; do echo $BIN; $BIN -H >/dev/null 2>&1; echo RC = $?; done
focal
Version: 2.0b3-16build1
/usr/bin/binhex
RC = 139
/usr/bin/frommac
RC = 139
/usr/bin/hexbin
RC = 0
/usr/bin/macsave
RC = 0
/usr/bin/macstream
RC = 0
/usr/bin/macunpack
RC = 0
/usr/bin/tomac
RC = 139
ubuntu@focal:~$

$ lsb_release -cs; dpkg -s macutils | grep ^Version:; dpkg -L macutils | grep /bin/ | while read BIN; do echo $BIN; $BIN -H >/dev/null 2>&1; echo RC = $?; done
jammy
Version: 2.0b3-17
/usr/bin/binhex
RC = 0
/usr/bin/frommac
RC = 0
/usr/bin/hexbin
RC = 0
/usr/bin/macsave
RC = 0
/usr/bin/macstream
RC = 0
/usr/bin/macunpack
RC = 0
/usr/bin/tomac
RC = 0

$ lsb_release -cs; dpkg -s macutils | grep ^Version:; dpkg -L macutils | grep /bin/ | while read BIN; do echo $BIN; $BIN -H >/dev/null 2>&1; echo RC = $?; done
No LSB modules are available.
mantic
Version: 2.0b3-17
/usr/bin/binhex
RC = 0
/usr/bin/frommac
RC = 0
/usr/bin/hexbin
RC = 0
/usr/bin/macsave
RC = 0
/usr/bin/macstream
RC = 0
/usr/bin/macunpack
RC = 0
/usr/bin/tomac
RC = 0

$ lsb_release -cs; dpkg -s macutils | grep ^Version:; dpkg -L macutils | grep /bin/ | while read BIN; do echo $BIN; $BIN -H >/dev/null 2>&1; echo RC = $?; done
No LSB modules are available.
noble
Version: 2.0b3-17
/usr/bin/binhex
RC = 0
/usr/bin/frommac
RC = 0
/usr/bin/hexbin
RC = 0
/usr/bin/macsave
RC = 0
/usr/bin/macstream
RC = 0
/usr/bin/macunpack
RC = 0
/usr/bin/tomac
RC = 0

Changed in macutils (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote : Please test proposed package

Hello Nathaniel, or anyone else affected,

Accepted macutils into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/macutils/2.0b3-16ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.