Skip to content

Commit 41c55d1

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Fix GH-16409: Segfault in exif_thumbnail when not dealing with a real file
2 parents 810a121 + 63c9d12 commit 41c55d1

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

ext/exif/exif.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4395,7 +4395,7 @@ static bool exif_read_from_impl(image_info_type *ImageInfo, php_stream *stream,
43954395
ImageInfo->FileName = NULL;
43964396

43974397
if (php_stream_is(ImageInfo->infile, PHP_STREAM_IS_STDIO)) {
4398-
if (VCWD_STAT(stream->orig_path, &st) >= 0) {
4398+
if (stream->orig_path && VCWD_STAT(stream->orig_path, &st) >= 0) {
43994399
zend_string *base;
44004400
if ((st.st_mode & S_IFMT) != S_IFREG) {
44014401
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Not a file");

ext/exif/tests/gh16409.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
GH-16409 (Segfault in exif_thumbnail when not dealing with a real file)
3+
--EXTENSIONS--
4+
exif
5+
--FILE--
6+
<?php
7+
$stream = popen('echo 1', 'r');
8+
var_dump(exif_thumbnail($stream, $pipes, $stream, $pipes));
9+
?>
10+
--EXPECTF--
11+
Warning: exif_thumbnail(): File too small (0) in %s on line %d
12+
bool(false)%A

0 commit comments

Comments
 (0)