mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Fix GH-16409: Segfault in exif_thumbnail when not dealing with a real file
Closes GH-16416.
This commit is contained in:
parent
d70b7811b0
commit
3843f0ecfe
3 changed files with 17 additions and 1 deletions
4
NEWS
4
NEWS
|
@ -17,6 +17,10 @@ PHP NEWS
|
|||
. Fixed bug GH-16316 (DOMXPath breaks when not initialized properly).
|
||||
(nielsdos)
|
||||
|
||||
- EXIF:
|
||||
. Fixed bug GH-16409 (Segfault in exif_thumbnail when not dealing with a
|
||||
real file). (nielsdos, cmb)
|
||||
|
||||
- GD:
|
||||
. Fixed bug GH-16334 (imageaffine overflow on matrix elements).
|
||||
(David Carlier)
|
||||
|
|
|
@ -4419,7 +4419,7 @@ static bool exif_read_from_impl(image_info_type *ImageInfo, php_stream *stream,
|
|||
ImageInfo->FileName = NULL;
|
||||
|
||||
if (php_stream_is(ImageInfo->infile, PHP_STREAM_IS_STDIO)) {
|
||||
if (VCWD_STAT(stream->orig_path, &st) >= 0) {
|
||||
if (stream->orig_path && VCWD_STAT(stream->orig_path, &st) >= 0) {
|
||||
zend_string *base;
|
||||
if ((st.st_mode & S_IFMT) != S_IFREG) {
|
||||
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Not a file");
|
||||
|
|
12
ext/exif/tests/gh16409.phpt
Normal file
12
ext/exif/tests/gh16409.phpt
Normal file
|
@ -0,0 +1,12 @@
|
|||
--TEST--
|
||||
GH-16409 (Segfault in exif_thumbnail when not dealing with a real file)
|
||||
--EXTENSIONS--
|
||||
exif
|
||||
--FILE--
|
||||
<?php
|
||||
$stream = popen('echo 1', 'r');
|
||||
var_dump(exif_thumbnail($stream, $pipes, $stream, $pipes));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: exif_thumbnail(): File too small (0) in %s on line %d
|
||||
bool(false)%A
|
Loading…
Add table
Add a link
Reference in a new issue