From 3acdca47030e6dc973cffc0063d45e1bef354a3e Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 26 Mar 2011 17:02:34 +0000 Subject: [PATCH] - Fixed bug #54395 (Phar::mount() crashes when calling with wrong parameters) --- ext/phar/phar_object.c | 2 +- ext/phar/tests/bug54395.phpt | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 ext/phar/tests/bug54395.phpt 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" -- 2.40.0