Segmentaion Fault Loading Largish JPEG (with sample code)
Posted: 2007-02-04T15:22:26-07:00
Running Centos 4, ImageMagick++ 6.0.7.1, the following sample program seg-faults with the provided image:
image: http://static.flickr.com/85/206793522_f5b98bed68_o.jpg
run command:
Two other similar, but smaller images work just fine:
http://static.flickr.com/85/206793522_f5b98bed68.jpg
http://static.flickr.com/85/206793522_f5b98bed68_b.jpg
Code: Select all
#include <iostream>
#include <Magick++.h>
#include <string>
using namespace Magick;
using namespace std;
int main(int argc, char *argv[]) {
Image *source_img;
if (argc < 2)
return -1;
source_img = new Image();
try {
cout << "loading: " << argv[1] << endl;
source_img->read(string(argv[1])); //this line fails
cout << "loaded" << endl;
} catch (const exception &error) {
throw;
}
delete source_img;
source_img = NULL;
return 0;
}
run command:
Code: Select all
./test http://static.flickr.com/85/206793522_f5b98bed68_o.jpg
http://static.flickr.com/85/206793522_f5b98bed68.jpg
http://static.flickr.com/85/206793522_f5b98bed68_b.jpg