From 686afc10bfe2fad59c8b552f60d34441e7e67d18 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Thu, 20 Jun 2024 05:57:05 +0100 Subject: [PATCH] Fix GH-14603: invalid null zip file entry. close GH-14610 --- NEWS | 4 ++++ ext/phar/tests/gh14603.phpt | Bin 0 -> 1198 bytes ext/phar/zip.c | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 ext/phar/tests/gh14603.phpt diff --git a/NEWS b/NEWS index 061a9e9483ac0..e91dee30c4f9f 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? ????, PHP 8.2.22 +- Phar: + . Fixed bug GH-14603 (null string from zip entry). + (David Carlier) + - PHPDBG: . Fixed bug GH-14596 (crashes with ASAN and ZEND_RC_DEBUG=1). (David Carlier) diff --git a/ext/phar/tests/gh14603.phpt b/ext/phar/tests/gh14603.phpt new file mode 100644 index 0000000000000000000000000000000000000000..95b9fa30fd559aec191c29817d3f99b65f03406c GIT binary patch literal 1198 zcma)6OHUL*5FSK`OaccmUi45*mSiR{i?0}E1wvqemB)^-2^uv^?`-c*>!xSy?&0Bv zgO7v1!Gpg*FCH}UCwL<90r7?mn1w+Fa7iMVDp;elci2We-BV>V1ck%}l5K&A}iK!hOMwlx|u3&tm)O6rn2 zxzvqS!DdoYWoOE_GUSfqfS@W793%C5&+A}|fm`wzU}&MK`FhM!;gc zLbvphalw;%ePsU#4%(!Jzutj>s2~LUwnp)`0ve|`$WR9wW)BU*2r|^2s8O{2wpl8nkHhci8N|^#(BzlZIKiCLY?*Nl{Gt4N>+l_HQ!$g|2QL)`j1F3|dRm zpS~NuH(i{?r(j6xt_3PYB*uX93Pe>1C|82ip~3_WRD>Z^NLm3M KJ0wkA*yc~?K^XV| literal 0 HcmV?d00001 diff --git a/ext/phar/zip.c b/ext/phar/zip.c index 1472906c8b9da..b610104acadeb 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -771,7 +771,7 @@ int phar_parse_zipfile(php_stream *fp, char *fname, size_t fname_len, char *alia } } - zend_hash_str_add_ptr(&(PHAR_G(phar_alias_map)), actual_alias, mydata->alias_len, mydata); + zend_hash_str_add_ptr(&(PHAR_G(phar_alias_map)), alias, alias_len, mydata); mydata->alias = pestrndup(alias, alias_len, mydata->is_persistent); mydata->alias_len = alias_len; } else {