getimagesize(): negative TIFF dimensions are narrowed into huge unsigned sizes
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
Línea de trabajo
Lee ext/standard/image.c:823-850 y céntrate en cómo se analizan y comprueban las dimensiones TIFF antes de devolverlas. Usa el ejemplo proporcionado con getimagesizefromstring() para reproducirlo; el trabajo estará hecho cuando las dimensiones negativas devuelvan bool(false) y las dimensiones TIFF válidas sigan funcionando.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
The following code:
<?php
$tiff = "II\x2a\x00" . pack('V', 8) . pack('v', 2)
. pack('vvVv', 256, 8, 1, 0xFFFF) . "\0\0"
. pack('vvVv', 257, 8, 1, 0xFFFE) . "\0\0"
. pack('V', 0);
var_dump(getimagesizefromstring($tiff));
Resulted in this output:
array(7) {
[0]=>
int(4294967295)
[1]=>
int(4294967294)
[2]=>
int(7)
[3]=>
string(22) "width="-1" height="-2""
["mime"]=>
string(10) "image/tiff"
["width_unit"]=>
string(2) "px"
["height_unit"]=>
string(2) "px"
}
But I expected this output instead:
bool(false)
The signed TIFF values are assigned to size_t and then narrowed into unsigned result fields in ext/standard/image.c:823-850, while the guard at line 846 checks only that the dimensions are nonzero. Negative dimensions must be rejected rather than sign-extended and published as 4294967295 and 4294967294.
PHP Version
PHP 8.7.0-dev (cli) (built: Nov 29 2026 03:42:09) (NTS)
Copyright © The PHP Group and Contributors
Zend Engine v4.7.0-dev, Copyright © Zend by Perforce
with Zend OPcache v8.7.0-dev, Copyright ©, by Zend by Perforce
Operating System
Ubuntu 24.04.5 LTS
- Lenguaje dominante
- C
- Estrellas
- 41.9k
- Forks
- 8.5k
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 111
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de php/php-src
-
Bug Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Bug Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Bug Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Bug Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Bug Status: Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
Todos los issues de php/php-src
Issues similares
-
bug no-disc-needed
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Jstar269/nakagawa-recomp#3421 ·
Los mantenedores suelen responder en 1 día
-
Research radar digest 2026-W49Abiertoresearch-radar
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
-
1 stb_image 2 bug w/ repro 5 merged-dev
Dificultad 1/5 Menos de una hora Aptitud para principiantes 83/100
nothings/stb#2070 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
-
needs-playtest
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Life-Framework/Life-Framework#5533 ·
Los mantenedores suelen responder en 1 día