git: 974d3ff05496 - main - archivers/pbzip2: fix more issues after libc++ 19 patches
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 18 Jan 2025 20:28:20 UTC
The branch main has been updated by dim:
URL: https://cgit.FreeBSD.org/ports/commit/?id=974d3ff054965d2bd2ab884a0579ed06c5a08b07
commit 974d3ff054965d2bd2ab884a0579ed06c5a08b07
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:28:01 +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
---
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 );
+