Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Jan 2025 20:38:34 GMT
From:      Dimitry Andric <dim@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-branches@FreeBSD.org
Subject:   git: 71fc928d82c4 - 2025Q1 - archivers/pbzip2: fix more issues after libc++ 19 patches
Message-ID:  <202501182038.50IKcYdN000092@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch 2025Q1 has been updated by dim:

URL: https://cgit.FreeBSD.org/ports/commit/?id=71fc928d82c4b8378229e096bb5b327d2106acb6

commit 71fc928d82c4b8378229e096bb5b327d2106acb6
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2025-01-18 20:26:02 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2025-01-18 20:38:17 +0000

    archivers/pbzip2: fix more issues after libc++ 19 patches
    
    * Ensure the _bz2Header and _bz2HeaderZero members of BZ2StreamScanner
      do not contain an additional NUL byte.
    * When comparing the magic header, compare from pHdr->begin() + hsp to
      pHdr->end(), making the code equivalent to what it was doing using
      std::basic_string::compare().
    
    Submitted by:   paparodeo@proton.me
    PR:             283655
    MFH:            2025Q1
    
    (cherry picked from commit 974d3ff054965d2bd2ab884a0579ed06c5a08b07)
---
 archivers/pbzip2/files/patch-BZ2StreamScanner.cpp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/archivers/pbzip2/files/patch-BZ2StreamScanner.cpp b/archivers/pbzip2/files/patch-BZ2StreamScanner.cpp
index 070f227c7ec1..19678e0d7d24 100644
--- a/archivers/pbzip2/files/patch-BZ2StreamScanner.cpp
+++ b/archivers/pbzip2/files/patch-BZ2StreamScanner.cpp
@@ -1,6 +1,16 @@
 --- BZ2StreamScanner.cpp.orig	2015-12-17 23:32:49 UTC
 +++ BZ2StreamScanner.cpp
-@@ -49,8 +49,8 @@ int BZ2StreamScanner::init( int hInFile, size_t inBuff
+@@ -42,15 +42,15 @@ int BZ2StreamScanner::init( int hInFile, size_t inBuff
+ {
+ 	dispose();
+ 
+-	CharType bz2header[] = "BZh91AY&SY";
+-	// zero-terminated string
++	CharType bz2header[] =
++		{ 'B', 'Z', 'h', '9', '1', 'A', 'Y', '&', 'S', 'Y' };
+ 	CharType bz2ZeroHeader[] =
+-		{ 'B', 'Z', 'h', '9', 0x17, 0x72, 0x45, 0x38, 0x50, 0x90, 0 };
++		{ 'B', 'Z', 'h', '9', 0x17, 0x72, 0x45, 0x38, 0x50, 0x90 };
  
  	_hInFile = hInFile;
  	_eof = false;
@@ -35,7 +45,7 @@
  				// compare the remaining part of magic header
 -				int cmpres = pHdr->compare( hsp, pHdr->size() - hsp,
 -						getInBuffSearchPtr() + hsp, pHdr->size() - hsp );
-+				bool cmpres = equal( pHdr->begin() + hsp, pHdr->begin() + pHdr->size() - hsp,
++				bool cmpres = equal( pHdr->begin() + hsp, pHdr->end(),
 +						getInBuffSearchPtr() + hsp );
  
 +



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202501182038.50IKcYdN000092>