php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76615 Segmentation fault with php://temp handler
Submitted: 2018-07-12 06:11 UTC Modified: 2021-08-15 04:22 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: martin at katoni dot dk Assigned: cmb (profile)
Status: No Feedback Package: imagick (PECL)
PHP Version: 7.2.7 OS: Docker php:7.2.7-apache
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
49 - 12 = ?
Subscribe to this entry?

 
 [2018-07-12 06:11 UTC] martin at katoni dot dk
Description:
------------
This bug only occurs for some image resources.

In the following example php fails with error "Segmentation fault":

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000559dbe907bcf in _php_stream_seek ()

Apperatently this is only caused by ImageMagick::writeImageFile(fopen('php://temp', 'w+'))

ImageMagick::writeImageFile(fopen('/tmp/image.jpg', 'w+')) and ImageMagick::writeImage('/tmp/image.jpg') works fine.

I've attached the failing TIFF image as a patch file.

Test script:
---------------
$imagick = new Imagick('/tmp/89538763640163');

$imagick->setInterlaceScheme(Imagick::INTERLACE_PLANE);
$imagick->stripImage();
$imagick->thumbnailImage(140, 200, true, true);

$handle = fopen('php://temp', 'w+');

$written = $imagick->writeImageFile($handle);


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-07-12 06:13 UTC] martin at katoni dot dk
I couldn't attach the image as a patch, but it can be found and downloaded from here:
https://dizw242ufxqut.cloudfront.net/images/product/householdappliances/hushllsapparater/image430/peugeot_nancy_pepparkvarn_akryl-42311126-41387594-frntl.jpg

File size: 358086 bytes
 [2018-07-12 06:16 UTC] martin at katoni dot dk
Imagick version 3.4.3

Imagick compiled with ImageMagick version => ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
Imagick using ImageMagick library version => ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org

ImageMagick release date => 20170114
ImageMagick number of supported formats:  => 236
ImageMagick supported formats => 3FR, AAI, AI, ART, ARW, AVI, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CRW, CUR, CUT, DATA, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FILE, FITS, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GROUP4, GV, H, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV
 [2021-08-02 12:03 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-08-02 12:03 UTC] cmb@php.net
That Website is no longer available; could you please make that
file available for download again (assuming the issue still exists
with the latest imagick 3.5.1)?
 [2021-08-15 04:22 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 10:01:26 2024 UTC