Created
February 22, 2012 17:35
-
-
Save springmeyer/1886226 to your computer and use it in GitHub Desktop.
c++ hextree crash testcase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Testcase demonstrating https://github.com/mapnik/mapnik/issues/1087 | |
To replicate, on Ubuntu Oneiric compile mapnik master **before**: | |
https://github.com/mapnik/mapnik/commit/5dee576df26b4aeafd182c41b510c4aa67b14b29 | |
Then do: | |
wget https://raw.github.com/gist/1886226/hex-crash.cpp | |
wget http://f.cl.ly/items/450Y0f2A461p3u292X07/11_1277_544.png | |
g++ -o hex-crash hex-crash.cpp `mapnik-config --libs --cflags` | |
./hex-crash | |
Segmentation fault | |
*/ | |
extern "C" | |
{ | |
#include <png.h> | |
} | |
#include <mapnik/graphics.hpp> | |
#include <mapnik/image_util.hpp> | |
#include <mapnik/png_io.hpp> | |
#include <mapnik/image_reader.hpp> | |
#include <mapnik/image_view.hpp> | |
#include <iostream> | |
#include <string> | |
int main() | |
{ | |
std::string filename("11_1277_544.png"); | |
std::string format("png8:m=h:g=1.0"); | |
// open image from filesystem | |
std::auto_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(filename,"png")); | |
mapnik::image_32 image(reader->width(),reader->height()); | |
reader->read(0,0,image.data()); | |
// get view | |
mapnik::image_view<mapnik::image_data_32> view = image.get_view(0,256,256,256); | |
// will segfault here | |
std::string s = save_to_string(view, format); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment