1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

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
This commit is contained in:
Niels Dossche
2024-10-13 21:12:46 +02:00
3 changed files with 17 additions and 1 deletions

4
NEWS
View File

@@ -18,6 +18,10 @@ PHP NEWS
(nielsdos)
. Add missing hierarchy checks to replaceChild. (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)

View File

@@ -4399,7 +4399,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");

View 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