<feed xmlns='http://www.w3.org/2005/Atom'>
<title>bzip2, branch master</title>
<subtitle>A mirror of https://sourceware.org/git/bzip2.git
</subtitle>
<id>https://git.lua4.win/bzip2/atom?h=master</id>
<link rel='self' href='https://git.lua4.win/bzip2/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.lua4.win/bzip2/'/>
<updated>2026-06-30T09:48:14+00:00</updated>
<entry>
<title>bzip2recover: Use snprintf to build the output file name</title>
<updated>2026-06-30T09:48:14+00:00</updated>
<author>
<name>Naveed Khan</name>
<email>naveed@digiscrypt.com</email>
</author>
<published>2026-06-26T16:28:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/bzip2/commit/?id=af35561761f36e2ce27484ca6d376326a80ebd1d'/>
<id>urn:sha1:af35561761f36e2ce27484ca6d376326a80ebd1d</id>
<content type='text'>
The per-block output file name is built in outFileName[BZ_MAX_FILENAME]
with sprintf(split, "rec%5d", wrBlock+1).  split is an interior pointer
into outFileName, past any leading directory component of the input file
name, so the bytes written here come right after attacker-influenced
path data.

The write is currently safe only by way of two non-local invariants: the
input file name is rejected up front once strlen(argv[1]) reaches
BZ_MAX_FILENAME-20, and the number of blocks is limited by
BZ_MAX_HANDLED_BLOCKS so the formatted value stays at five digits.  The
comment on BZ_MAX_HANDLED_BLOCKS explicitly invites raising it, which
would silently eat into that 20 byte margin.

Bound the write with snprintf() using the space left after the directory
prefix (BZ_MAX_FILENAME - ofs) so it can no longer overrun outFileName
regardless of those invariants.  This also removes the deprecated
sprintf(), which recent compilers flag under -Wdeprecated-declarations.

For valid input the result is unchanged: the "rec%5d" prefix always fits,
so snprintf() writes exactly the same bytes.

https://sourceware.org/bugzilla/show_bug.cgi?id=29280
</content>
</entry>
<entry>
<title>bzip2recover: Check argc &gt;= 1 &amp;&amp; argv[0] != NULL</title>
<updated>2026-06-21T22:37:44+00:00</updated>
<author>
<name>Naveed Khan</name>
<email>naveed@digiscrypt.com</email>
</author>
<published>2026-06-21T21:09:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/bzip2/commit/?id=f153ef257a8e8901d8f8ed96fd1a2467806e8755'/>
<id>urn:sha1:f153ef257a8e8901d8f8ed96fd1a2467806e8755</id>
<content type='text'>
main() initialises progName by copying argv[0] with strncpy before argc
is examined. When the program is started with an empty argument vector
(argc == 0 and argv[0] == NULL), for example through
execve(path, (char*[]){ NULL }, envp), this dereferences a NULL pointer
and bzip2recover crashes with SIGSEGV before any argument checking
happens.

Guard the use of argv[0] and fall back to a hard coded "bzip2recover"
string, mirroring the fix already applied to bzip2.c in commit
af79253677ad ("bzip2.c: Check argc &gt;= 1 &amp;&amp; argv[0] != NULL").
</content>
</entry>
<entry>
<title>bzip2recover: bsClose bsWr on early EOF</title>
<updated>2026-06-11T21:19:53+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2026-05-28T17:31:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/bzip2/commit/?id=9515e7ff78facd349ba3d86a637be71acaccc02e'/>
<id>urn:sha1:9515e7ff78facd349ba3d86a637be71acaccc02e</id>
<content type='text'>
When getting an early EOF bsWr is never closed so any buffered output
is leaked and never flushed out to the file.
</content>
</entry>
<entry>
<title>bzip2recover: bsClose bsIn before exit</title>
<updated>2026-06-11T21:16:46+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2026-05-28T17:22:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/bzip2/commit/?id=42cc1a9559e02844ff4b9698b838ec73ea56cc1a'/>
<id>urn:sha1:42cc1a9559e02844ff4b9698b838ec73ea56cc1a</id>
<content type='text'>
This makes sure to cleanup all the memory used and opened file
descriptors.

With this fix valgrind shows no more "leaked" file descriptors or
memory when run with --leak-check=full --show-leak-kinds=all
--track-fds=yes on a valid bzip2 file.
</content>
</entry>
<entry>
<title>bzip2recover: Fix getc EOF errno handling</title>
<updated>2026-06-11T21:11:29+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2026-05-28T17:01:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/bzip2/commit/?id=4d3533d71c26968fd113cc8d50e6f0c48475b7a9'/>
<id>urn:sha1:4d3533d71c26968fd113cc8d50e6f0c48475b7a9</id>
<content type='text'>
Posix getc requires setting errno on read error. But it isn't required
to clear errno when reporting EOF. So explicitly set errno to zero
before calling getc to make sure we see the difference between a read
error and a regular EOF.
</content>
</entry>
<entry>
<title>bzip2recover: Add one more wraparound sanity check</title>
<updated>2026-06-11T21:09:45+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2026-05-28T16:49:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/bzip2/commit/?id=6ab7670e74d3bada5bf9a7dc5af28a68064db151'/>
<id>urn:sha1:6ab7670e74d3bada5bf9a7dc5af28a68064db151</id>
<content type='text'>
Make sure the end of the current block is actually larger than the
start of the current block. Then check the difference is big
enough. This prevents a possible unsigned underflow.
</content>
</entry>
<entry>
<title>bzip2recover: Use standard %llu format specifier</title>
<updated>2026-06-11T20:00:23+00:00</updated>
<author>
<name>Josef Schlehofer</name>
<email>pepe.schlehofer@gmail.com</email>
</author>
<published>2026-06-09T09:45:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/bzip2/commit/?id=33866efaf4b5e8d3ccdff89ba4af9e20955f4069'/>
<id>urn:sha1:33866efaf4b5e8d3ccdff89ba4af9e20955f4069</id>
<content type='text'>
Update the format specifier for unsigned long long in bzip2recover.c to use
the standard %llu instead of %Lu. Modern compilers (such as Clang) emit a format
warning when using the non-standard %Lu modifier.

Fixes:
bzip2recover.c:376:59: warning: length modifier 'L' results in undefined behavior or no effect with 'u' conversion specifier [-Wformat]
  376 |                fprintf ( stderr, "   block %d runs from " MaybeUInt64_FMT
      |                                                           ^~~~~~~~~~~~~~~
bzip2recover.c:40:29: note: expanded from macro 'MaybeUInt64_FMT'
   40 | #  define MaybeUInt64_FMT "%Lu"
      |                            ~^~
bzip2recover.c:376:59: note: did you mean to use 'll'?

Signed-off-by: Josef Schlehofer &lt;pepe.schlehofer@gmail.com&gt;
</content>
</entry>
<entry>
<title>bzip2recover: Make sure to not process more than BZ_MAX_HANDLED_BLOCKS</title>
<updated>2026-05-28T14:53:21+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2026-05-28T14:15:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/bzip2/commit/?id=35d122a3df8b0cc4082a4d89fdc6ee99f375fe67'/>
<id>urn:sha1:35d122a3df8b0cc4082a4d89fdc6ee99f375fe67</id>
<content type='text'>
There is an off-by-one in the check before calling tooManyBlocks. This
causes the scanning loop to run one more time and cause a possible
read or write one past the global bStart, bEnd, rbStart and rbEnd
buffers. There are no known exploits of this issue and you will need
to compile with something like gcc -fsanitize=address (ASAN
AddressSanitizer) to observe the faulty read/write.

This has been assigned CVE-2026-42250.
</content>
</entry>
<entry>
<title>bzip2.c: Check argc &gt;= 1 &amp;&amp; argv[0] != NULL</title>
<updated>2025-06-19T19:07:31+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2025-06-19T19:07:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/bzip2/commit/?id=af79253677ad98d6dfe11ea315ee9947d86586d3'/>
<id>urn:sha1:af79253677ad98d6dfe11ea315ee9947d86586d3</id>
<content type='text'>
This should never happen, but if there is no, or a NULL argv[0] then
use a hard coded string "bzip2" when calling copyFileName to define
progNameReally.

https://sourceware.org/bugzilla/show_bug.cgi?id=33046
</content>
</entry>
<entry>
<title>bzlib.h: Move #includes outside extern "C" {...}</title>
<updated>2025-06-15T12:51:05+00:00</updated>
<author>
<name>Mark Wielaard</name>
<email>mark@klomp.org</email>
</author>
<published>2025-06-15T12:50:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.lua4.win/bzip2/commit/?id=2b76d786553ef5a0325bd77cce02541cdf76827e'/>
<id>urn:sha1:2b76d786553ef5a0325bd77cce02541cdf76827e</id>
<content type='text'>
This helps C++ compilers that come with their own standard library
headers that don't expect to be included inside of extern "C" {...}.

https://sourceware.org/bugzilla/show_bug.cgi?id=32812
</content>
</entry>
</feed>
