Skip to content

Instantly share code, notes, and snippets.

/73773.diff Secret

Created January 1, 2017 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/b7b2c560555bedec94a12f73cacc182f to your computer and use it in GitHub Desktop.
Save anonymous/b7b2c560555bedec94a12f73cacc182f to your computer and use it in GitHub Desktop.
Patch for 73773
commit e5246580a85f031e1a3b8064edbaa55c1643a451
Author: Stanislav Malyshev <stas@php.net>
Date: Sat Dec 31 18:47:50 2016 -0800
Fix bug #73773 - Seg fault when loading hostile phar
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index 158f417..780be43 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -1054,7 +1054,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
entry.is_persistent = mydata->is_persistent;
for (manifest_index = 0; manifest_index < manifest_count; ++manifest_index) {
- if (buffer + 24 > endbuffer) {
+ if (buffer + 28 > endbuffer) {
MAPPHAR_FAIL("internal corruption of phar \"%s\" (truncated manifest entry)")
}
@@ -1068,7 +1068,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
entry.manifest_pos = manifest_index;
}
- if (entry.filename_len > endbuffer - buffer - 20) {
+ if (entry.filename_len > endbuffer - buffer - 24) {
MAPPHAR_FAIL("internal corruption of phar \"%s\" (truncated manifest entry)");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment