gmic/gmic-overflow.diff

14 lines
800 B
Diff

Index: gmic-1.6.0.0/src/CImg.h
===================================================================
--- gmic-1.6.0.0.orig/src/CImg.h
+++ gmic-1.6.0.0/src/CImg.h
@@ -48529,7 +48529,7 @@ namespace cimg_library_suffixed {
#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];