]> granicus.if.org Git - php/commitdiff
other fix for #64214, unmodified file may not have old fp set, causing other possible...
authorPierre Joye <pierre.php@gmail.com>
Fri, 17 May 2013 09:45:13 +0000 (11:45 +0200)
committerPierre Joye <pierre.php@gmail.com>
Fri, 17 May 2013 09:45:13 +0000 (11:45 +0200)
ext/phar/zip.c

index c8057e3bbe1afafbcb1472b12e3acb4cbdfea9d5..6ba745e9cbf74597fc1d1ef5f91f8252f154977f 100644 (file)
@@ -937,10 +937,11 @@ is_compressed:
                PHAR_SET_32(local.uncompsize, entry->uncompressed_filesize);
                PHAR_SET_32(central.compsize, entry->compressed_filesize);
                PHAR_SET_32(local.compsize, entry->compressed_filesize);
-
-               if (-1 == php_stream_seek(p->old, entry->offset_abs, SEEK_SET)) {
-                       spprintf(p->error, 0, "unable to seek to start of file \"%s\" while creating zip-based phar \"%s\"", entry->filename, entry->phar->fname);
-                       return ZEND_HASH_APPLY_STOP;
+               if (p->old) {
+                       if (-1 == php_stream_seek(p->old, entry->offset_abs, SEEK_SET)) {
+                               spprintf(p->error, 0, "unable to seek to start of file \"%s\" while creating zip-based phar \"%s\"", entry->filename, entry->phar->fname);
+                               return ZEND_HASH_APPLY_STOP;
+                       }
                }
        }
 not_compressed: