From: Felipe Pena Date: Sat, 26 Mar 2011 17:02:34 +0000 (+0000) Subject: - Fixed bug #54395 (Phar::mount() crashes when calling with wrong parameters) X-Git-Tag: php-5.4.0alpha1~191^2~109 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3acdca47030e6dc973cffc0063d45e1bef354a3e;p=php - Fixed bug #54395 (Phar::mount() crashes when calling with wrong parameters) --- diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 732e6a3cd6..afe12851b5 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -629,7 +629,7 @@ carry_on: } return; - } else if (SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), fname, fname_len, (void **)&pphar)) { + } else if (PHAR_GLOBALS->phar_fname_map.arBuckets && SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), fname, fname_len, (void **)&pphar)) { goto carry_on; } else if (PHAR_G(manifest_cached) && SUCCESS == zend_hash_find(&cached_phars, fname, fname_len, (void **)&pphar)) { if (SUCCESS == phar_copy_on_write(pphar TSRMLS_CC)) { diff --git a/ext/phar/tests/bug54395.phpt b/ext/phar/tests/bug54395.phpt new file mode 100644 index 0000000000..091ed326a8 --- /dev/null +++ b/ext/phar/tests/bug54395.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #54395 (Phar::mount() crashes when calling with wrong parameters) +--SKIPIF-- + +--FILE-- +getMessage()); +} + +?> +--EXPECTF-- +string(25) "Mounting of 1 to 1 failed"