Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime error: 5.90296e+20 is outside the range of representable values of type 'long' in libgd #18243

Closed
YuanchengJiang opened this issue Apr 4, 2025 · 0 comments

Comments

@YuanchengJiang
Copy link

Description

The following code:

<?php
$font = __DIR__.'/Rochester-Regular.otf';
$im = imagecreatetruecolor(
100,
80
);
imagefilledrectangle(
$im,
0,
0,
100,
80,
$white
);
imagettftext(
$im,
PHP_INT_MAX,
0,
15,
60,
$black,
$font,
$sample_string
);

Resulted in this output:

/home/phpfuzz/WorkSpace/flowfusion/php-src/ext/gd/libgd/gdft.c:920:32: runtime error: 5.90296e+20 is outside the range of representable values of type 'long'
    #0 0x18bdecf in php_gd_gdImageStringFTEx /home/phpfuzz/WorkSpace/flowfusion/php-src/ext/gd/libgd/gdft.c:920:32
    #1 0x18b9b36 in php_gd_gdImageStringFT /home/phpfuzz/WorkSpace/flowfusion/php-src/ext/gd/libgd/gdft.c:829:9
    #2 0x1759977 in php_imagettftext_common /home/phpfuzz/WorkSpace/flowfusion/php-src/ext/gd/gd.c:3391:11
    #3 0x175a07e in zif_imagefttext /home/phpfuzz/WorkSpace/flowfusion/php-src/ext/gd/gd.c:3338:2
    #4 0x4f250e9 in ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_vm_execute.h:1340:2
    #5 0x4a18b97 in execute_ex /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_vm_execute.h:58690:7
    #6 0x4a1ae1c in zend_execute /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_vm_execute.h:64342:2
    #7 0x57c5889 in zend_execute_script /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend.c:1943:3
    #8 0x3fa5eca in php_execute_script_ex /home/phpfuzz/WorkSpace/flowfusion/php-src/main/main.c:2594:13
    #9 0x3fa7008 in php_execute_script /home/phpfuzz/WorkSpace/flowfusion/php-src/main/main.c:2634:9
    #10 0x57da79a in do_cli /home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php_cli.c:952:5
    #11 0x57d4b7f in main /home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php_cli.c:1355:18
    #12 0x7f0580ef6d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #13 0x7f0580ef6e3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #14 0x606174 in _start (/home/phpfuzz/WorkSpace/flowfusion/php-src/sapi/cli/php+0x606174)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/phpfuzz/WorkSpace/flowfusion/php-src/ext/gd/libgd/gdft.c:920:32 in 

To reproduce:

./php-src/sapi/cli/php  ./test.php

Commit:

68665d3cb5dcda5b966fc9edd577581be763ee63

Configurations:

CC="clang-12" CXX="clang++-12" CFLAGS="-DZEND_VERIFY_TYPE_INFERENCE" CXXFLAGS="-DZEND_VERIFY_TYPE_INFERENCE" ./configure --enable-debug --enable-address-sanitizer --enable-undefined-sanitizer --enable-re2c-cgoto --enable-fpm --enable-litespeed --enable-phpdbg-debug --enable-zts --enable-bcmath --enable-calendar --enable-dba --enable-dl-test --enable-exif --enable-ftp --enable-gd --enable-gd-jis-conv --enable-mbstring --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvmsg --enable-zend-test --with-zlib --with-bz2 --with-curl --with-enchant --with-gettext --with-gmp --with-mhash --with-ldap --with-libedit --with-readline --with-snmp --with-sodium --with-xsl --with-zip --with-mysqli --with-pdo-mysql --with-pdo-pgsql --with-pgsql --with-sqlite3 --with-pdo-sqlite --with-webp --with-jpeg --with-freetype --enable-sigchild --with-readline --with-pcre-jit --with-iconv

Operating System:

Ubuntu 20.04 Host, Docker 0599jiangyc/flowfusion:latest

This report is automatically generated by FlowFusion

PHP Version

68665d3

Operating System

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants