gmic/gmic-overflow.diff

16 lines
942 B
Diff
Raw Normal View History

Index: gmic-1.5.8.4/src/CImg.h
===================================================================
--- gmic-1.5.8.4.orig/src/CImg.h
+++ gmic-1.5.8.4/src/CImg.h
@@ -45929,9 +45929,9 @@ namespace cimg_library_suffixed {
filename?filename:"(FILE*)");
#endif
std::FILE *const nfile = file?file:cimg::fopen(filename,"wb");
const char *const ptype = pixel_type(), *const etype = cimg::endianness()?"big":"little";
- if (std::strstr(ptype,"unsigned")==ptype) std::fprintf(nfile,"%u unsigned_%s %s_endian\n",_width,ptype+9,etype);
+ if (std::strlen(ptype)>9 && std::strstr(ptype,"unsigned")==ptype) std::fprintf(nfile,"%u unsigned_%s %s_endian\n",_width,ptype+9,etype);
else std::fprintf(nfile,"%u %s %s_endian\n",_width,ptype,etype);
cimglist_for(*this,l) {
const CImg<T>& img = _data[l];
std::fprintf(nfile,"%u %u %u %u",img._width,img._height,img._depth,img._spectrum);