imagescale(..., IMG_BICUBIC) is not supposed to work with palette images, so we
fix that by converting to true color if necessary. Basically the same fix has
already been applied to the external libgd[1].
[1] <https://github.com/libgd/libgd/commit/
723ea520bed3b5854df87393c687323d3930edf3>
gdImagePtr tmp_im;
gdImagePtr dst;
+ /* Convert to truecolor if it isn't; this code requires it. */
+ if (!src->trueColor) {
+ gdImagePaletteToTrueColor(src);
+ }
+
tmp_im = gdImageCreateTrueColor(new_width, src_height);
if (tmp_im == NULL) {
return NULL;
--- /dev/null
+--TEST--
+Bug #69024 (imagescale segfault with palette based image)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+$im = imagecreate(256, 256);
+imagescale($im, 32, 32, IMG_BICUBIC);
+imagedestroy($im);
+echo "done\n";
+?>
+--EXPECT--
+done