Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 75305 - bzip2 1.0.2 minor zlib compatibility layer bug (missing NULLptr check)
Summary: bzip2 1.0.2 minor zlib compatibility layer bug (missing NULLptr check)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-22 05:42 UTC by Mihai Limbasan
Modified: 2004-12-26 13:46 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to bzip2 to fix the issue. (bzclose-nullptr-check.diff,487 bytes, patch)
2004-12-22 05:44 UTC, Mihai Limbasan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mihai Limbasan 2004-12-22 05:42:54 UTC
BZ2_bzclose fails to perform a NULL pointer check before actually
using the passed BZFILE * argument. The NULL check *is* performed but
only after the argument is used for the first time, resulting in a
potential NULL pointer dereference.

Reproducible: Always
Steps to Reproduce:
1. Call BZ2_bzclose with a NULL argument, resulting in a NULL pointer dereference.
Actual Results:  
SIGSEGV issued

Expected Results:  
BZ2_bzclose should have just returned without doing anything.

Bug also reported to upstream bzip2 authors / maintainers.
Comment 1 Mihai Limbasan 2004-12-22 05:44:08 UTC
Created attachment 46625 [details, diff]
Patch to bzip2 to fix the issue.

Attached patch modifies BZ2_bzclose to check its argument before first using
it, not afterwards.
Comment 2 SpanKY gentoo-dev 2004-12-22 15:34:21 UTC
i noticed this while coding some zlib/bzip2 apps of mine but figured it was a feature ? :)

did you make this patch yourself ?  if so, have you sent it upstream ?
Comment 3 Mihai Limbasan 2004-12-22 18:57:07 UTC
Definitely a bug, not a feature.
Yes and yes.
Comment 4 Mihai Limbasan 2004-12-22 19:00:20 UTC
The report email seems to only have been accepted by Mr. Seward's mail server (jseward [at] acm.org). The zlib compatibility layer author seems to have dropped off the map - both QWF00133 [at] niftyserve.or.jp and tsuneo-y [at] is.aist-nara.ac.jp bounce.
Comment 5 SpanKY gentoo-dev 2004-12-22 21:33:37 UTC
awesome ... if you havent heard back from them in a few days i'll gladly merge this fix :)
Comment 6 Mihai Limbasan 2004-12-26 13:04:47 UTC
No reaction from Mr. Seward yet - I think you can merge this thing. It's a very simple and trivial patch anyway (I stumbled over it by accident while studying the sources).
Comment 7 SpanKY gentoo-dev 2004-12-26 13:46:15 UTC
added to 1.0.2-r4

please keep us updated if you get word back from upstream :)