Nothing Special   »   [go: up one dir, main page]

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

UBSan abort in ext/gd/libgd/gd_interpolation.c:1007 #16559

Closed
YuanchengJiang opened this issue Oct 23, 2024 · 1 comment
Closed

UBSan abort in ext/gd/libgd/gd_interpolation.c:1007 #16559

YuanchengJiang opened this issue Oct 23, 2024 · 1 comment

Comments

@YuanchengJiang
Copy link

Description

The following code:

<?php
$input = imagecreatefrompng(__DIR__ . '/gh10614.png');
for ($angle = 0; $angle <= 270; $angle += 90) {
$output = imagerotate($input, $angle, 0);
}
$fusion = $output;
$thumbnail = imagescale($fusion, -1, 64, IMG_BICUBIC);

Resulted in this output:

/php-src/ext/gd/libgd/gd_interpolation.c:1007:28: runtime error: left shift of 134 by 24 places cannot be represented in type 'int'

PHP Version

nightly

Operating System

ubuntu 22.04

@nielsdos
Copy link
Member

Right, alpha must be 0x7f at most; uchar_clamp in upstream takes an extra argument but we don't...

@nielsdos nielsdos self-assigned this Oct 23, 2024
nielsdos added a commit to nielsdos/php-src that referenced this issue Oct 23, 2024
The `uchar_clamp` function was backported from old code, this backports
it from new code.
nielsdos added a commit that referenced this issue Oct 23, 2024
* PHP-8.2:
  Fix GH-16559: UBSan abort in ext/gd/libgd/gd_interpolation.c:1007
nielsdos added a commit that referenced this issue Oct 23, 2024
* PHP-8.3:
  Fix GH-16559: UBSan abort in ext/gd/libgd/gd_interpolation.c:1007
nielsdos added a commit that referenced this issue Oct 23, 2024
* PHP-8.4:
  Fix GH-16559: UBSan abort in ext/gd/libgd/gd_interpolation.c:1007
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