Skip to content

Commit 34e635f

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix GH-16409: Segfault in exif_thumbnail when not dealing with a real file
2 parents 47c8146 + 3843f0e commit 34e635f

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ PHP NEWS
1818
(nielsdos)
1919
. Add missing hierarchy checks to replaceChild. (nielsdos)
2020

21+
- EXIF:
22+
. Fixed bug GH-16409 (Segfault in exif_thumbnail when not dealing with a
23+
real file). (nielsdos, cmb)
24+
2125
- GD:
2226
. Fixed bug GH-16334 (imageaffine overflow on matrix elements).
2327
(David Carlier)

ext/exif/exif.c

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

44014401
if (php_stream_is(ImageInfo->infile, PHP_STREAM_IS_STDIO)) {
4402-
if (VCWD_STAT(stream->orig_path, &st) >= 0) {
4402+
if (stream->orig_path && VCWD_STAT(stream->orig_path, &st) >= 0) {
44034403
zend_string *base;
44044404
if ((st.st_mode & S_IFMT) != S_IFREG) {
44054405
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)