[php-src] master: Fix -Wtype-limits warnings in ext/zip string source (#24347)

From: Date: Thu, 15 Oct 2026 18:37:39 +0000
Subject: [php-src] master: Fix -Wtype-limits warnings in ext/zip string source (#24347)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142332@lists.php.net to get a copy of this message
Author: Marc Bennewitz (marc-mabe) Committer: GitHub (web-flow) Pusher: LamentXU123 Date: 2026-10-16T02:37:36+08:00 Commit: https://github.com/php/php-src/commit/ed1545209f344d236edac1670b4d14b9d37cf695 Raw diff: https://github.com/php/php-src/commit/ed1545209f344d236edac1670b4d14b9d37cf695.diff Fix -Wtype-limits warnings in ext/zip string source (#24347) The TELL overflow checks compare a size_t offset against ZIP_INT64_MAX. Where size_t is 32-bit, the comparison is always false and GCC warns, which breaks --enable-werror builds. Only compile the checks where size_t can exceed ZIP_INT64_MAX. Changed paths: M ext/zip/zip_source.c Diff: diff --git a/ext/zip/zip_source.c b/ext/zip/zip_source.c index 03fa50867d56..0bbe5782ad78 100644 --- a/ext/zip/zip_source.c +++ b/ext/zip/zip_source.c @@ -124,10 +124,12 @@ static zip_int64_t php_zip_string_cb(void *userdata, void *data, zip_uint64_t le } case ZIP_SOURCE_TELL: +#if SIZE_MAX > ZIP_INT64_MAX if (ctx->in_offset > ZIP_INT64_MAX) { zip_error_set(&ctx->error, ZIP_ER_TELL, EOVERFLOW); return -1; } +#endif return (zip_int64_t)ctx->in_offset; /* Write ops */ @@ -176,10 +178,12 @@ static zip_int64_t php_zip_string_cb(void *userdata, void *data, zip_uint64_t le } case ZIP_SOURCE_TELL_WRITE: +#if SIZE_MAX > ZIP_INT64_MAX if (ctx->out_offset > ZIP_INT64_MAX) { zip_error_set(&ctx->error, ZIP_ER_TELL, EOVERFLOW); return -1; } +#endif return (zip_int64_t)ctx->out_offset; case ZIP_SOURCE_REMOVE:

« previous php.cvs (#142332) next »