Wed Mar 13 11:29:57 2019 UTC ()
Pull up following revision(s) (requested by martin in ticket #1684):
	external/bsd/bzip2/dist/bzip2recover.c: revision 1.4
Apply fix for CVE-2016-3189 bzip2: heap use after free in bzip2recover


(msaitoh)
diff -r1.3 -r1.3.24.1 src/external/bsd/bzip2/dist/bzip2recover.c

cvs diff -r1.3 -r1.3.24.1 src/external/bsd/bzip2/dist/bzip2recover.c (expand / switch to unified diff)

--- src/external/bsd/bzip2/dist/bzip2recover.c 2012/05/07 00:45:47 1.3
+++ src/external/bsd/bzip2/dist/bzip2recover.c 2019/03/13 11:29:57 1.3.24.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bzip2recover.c,v 1.3 2012/05/07 00:45:47 wiz Exp $ */ 1/* $NetBSD: bzip2recover.c,v 1.3.24.1 2019/03/13 11:29:57 msaitoh Exp $ */
2 2
3/*-----------------------------------------------------------*/ 3/*-----------------------------------------------------------*/
4/*--- Block recoverer program for bzip2 ---*/ 4/*--- Block recoverer program for bzip2 ---*/
5/*--- bzip2recover.c ---*/ 5/*--- bzip2recover.c ---*/
6/*-----------------------------------------------------------*/ 6/*-----------------------------------------------------------*/
7 7
8/* ------------------------------------------------------------------ 8/* ------------------------------------------------------------------
9 This file is part of bzip2/libbzip2, a program and library for 9 This file is part of bzip2/libbzip2, a program and library for
10 lossless, block-sorting data compression. 10 lossless, block-sorting data compression.
11 11
12 bzip2/libbzip2 version 1.0.6 of 6 September 2010 12 bzip2/libbzip2 version 1.0.6 of 6 September 2010
13 Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> 13 Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
14 14
@@ -462,26 +462,27 @@ Int32 main ( Int32 argc, Char** argv ) @@ -462,26 +462,27 @@ Int32 main ( Int32 argc, Char** argv )
462 && bitsRead <= rbEnd[wrBlock]) { 462 && bitsRead <= rbEnd[wrBlock]) {
463 bsPutBit ( bsWr, b ); 463 bsPutBit ( bsWr, b );
464 } 464 }
465 465
466 bitsRead++; 466 bitsRead++;
467 467
468 if (bitsRead == rbEnd[wrBlock]+1) { 468 if (bitsRead == rbEnd[wrBlock]+1) {
469 if (outFile != NULL) { 469 if (outFile != NULL) {
470 bsPutUChar ( bsWr, 0x17 ); bsPutUChar ( bsWr, 0x72 ); 470 bsPutUChar ( bsWr, 0x17 ); bsPutUChar ( bsWr, 0x72 );
471 bsPutUChar ( bsWr, 0x45 ); bsPutUChar ( bsWr, 0x38 ); 471 bsPutUChar ( bsWr, 0x45 ); bsPutUChar ( bsWr, 0x38 );
472 bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 ); 472 bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 );
473 bsPutUInt32 ( bsWr, blockCRC ); 473 bsPutUInt32 ( bsWr, blockCRC );
474 bsClose ( bsWr ); 474 bsClose ( bsWr );
 475 outFile = NULL;
475 } 476 }
476 if (wrBlock >= rbCtr) break; 477 if (wrBlock >= rbCtr) break;
477 wrBlock++; 478 wrBlock++;
478 } else 479 } else
479 if (bitsRead == rbStart[wrBlock]) { 480 if (bitsRead == rbStart[wrBlock]) {
480 /* Create the output file name, correctly handling leading paths.  481 /* Create the output file name, correctly handling leading paths.
481 (31.10.2001 by Sergey E. Kusikov) */ 482 (31.10.2001 by Sergey E. Kusikov) */
482 Char* split; 483 Char* split;
483 Int32 ofs, k; 484 Int32 ofs, k;
484 for (k = 0; k < BZ_MAX_FILENAME; k++)  485 for (k = 0; k < BZ_MAX_FILENAME; k++)
485 outFileName[k] = 0; 486 outFileName[k] = 0;
486 strcpy (outFileName, inFileName); 487 strcpy (outFileName, inFileName);
487 split = strrchr (outFileName, BZ_SPLIT_SYM); 488 split = strrchr (outFileName, BZ_SPLIT_SYM);