Commit ed1545209f3 for php
commit ed1545209f344d236edac1670b4d14b9d37cf695
Author: Marc Bennewitz <marc-mabe@users.noreply.github.com>
Date: Thu Oct 15 20:37:36 2026 +0200
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.
diff --git a/ext/zip/zip_source.c b/ext/zip/zip_source.c
index 03fa50867d5..0bbe5782ad7 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: