IMG_xcf.c
changeset 569 fb643e371806
parent 568 c5f9cbb5d2bb
child 575 36e9e2255178
equal deleted inserted replaced
568:c5f9cbb5d2bb 569:fb643e371806
   592     Uint32         x, y, tx, ty, ox, oy;
   592     Uint32         x, y, tx, ty, ox, oy;
   593     Uint32         *row;
   593     Uint32         *row;
   594 
   594 
   595     SDL_RWseek(src, layer->hierarchy_file_offset, RW_SEEK_SET);
   595     SDL_RWseek(src, layer->hierarchy_file_offset, RW_SEEK_SET);
   596     hierarchy = read_xcf_hierarchy(src);
   596     hierarchy = read_xcf_hierarchy(src);
       
   597 
       
   598     if (hierarchy->bpp > 4) {  /* unsupported. */
       
   599         SDL_Log("Unknown Gimp image bpp (%u)\n", (unsigned int) hierarchy->bpp);
       
   600         free_xcf_hierarchy(hierarchy);
       
   601         return 1;
       
   602     }
       
   603 
       
   604     if ((hierarchy->width > 20000) || (hierarchy->height > 20000)) {  /* arbitrary limit to avoid integer overflow. */
       
   605         SDL_Log("Gimp image too large (%ux%u)\n", (unsigned int) hierarchy->width, (unsigned int) hierarchy->height);
       
   606         free_xcf_hierarchy(hierarchy);
       
   607         return 1;
       
   608     }
   597 
   609 
   598     level = NULL;
   610     level = NULL;
   599     for (i = 0; hierarchy->level_file_offsets[i]; i++) {
   611     for (i = 0; hierarchy->level_file_offsets[i]; i++) {
   600         SDL_RWseek(src, hierarchy->level_file_offsets[i], RW_SEEK_SET);
   612         SDL_RWseek(src, hierarchy->level_file_offsets[i], RW_SEEK_SET);
   601         level = read_xcf_level(src);
   613         level = read_xcf_level(src);