Skip to content

Instantly share code, notes, and snippets.

@Sembiance
Created July 24, 2020 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sembiance/d9fdbefe40feae39ee700d1b168e23bb to your computer and use it in GitHub Desktop.
Save Sembiance/d9fdbefe40feae39ee700d1b168e23bb to your computer and use it in GitHub Desktop.
Test abydos crash
// Place in current working directory: https://telparia.com/fileFormatSamples/image/SPRITESCO.ABK
// Compile with: gcc -I/usr/include/cairo -I/usr/include/abydos -lm -lcairo -labydos-0.2 -o test test.c
// Run as: ./test
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include <abydos.h>
#include <cairo.h>
int main(int argc, char ** argv)
{
abydos_t * ar;
cairo_surface_t * surface;
ar = abydos_create("image/x-amos-spritebank");
if(!ar)
exit(EXIT_FAILURE);
if(abydos_from_file(ar, "SPRITESCO.ABK")!=0)
exit(EXIT_FAILURE);
surface = abydos_get_image_surface(ar);
abydos_destroy(ar);
if(cairo_surface_write_to_png(surface, "out.png")!=CAIRO_STATUS_SUCCESS)
{
cairo_surface_destroy(surface);
exit(EXIT_FAILURE);
}
cairo_surface_destroy(surface);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment