Blame SOURCES/djvulibre-3.5.27-buffer-overflow.patch

a9380a
--- djvulibre-3.5.27/libdjvu/DjVmDir.cpp
a9380a
+++ djvulibre-3.5.27/libdjvu/DjVmDir.cpp
a9380a
@@ -300,6 +300,9 @@ DjVmDir::decode(const GP<ByteStream> &gs
a9380a
          memcpy((char*) strings+strings_size, buffer, length);
a9380a
       }
a9380a
       DEBUG_MSG("size of decompressed names block=" << strings.size() << "\n");
a9380a
+      int strings_size=strings.size();
a9380a
+      strings.resize(strings_size+3);
a9380a
+      memset((char*) strings+strings_size, 0, 4);
a9380a
    
a9380a
          // Copy names into the files
a9380a
       const char * ptr=strings;
a9380a
@@ -307,6 +310,8 @@ DjVmDir::decode(const GP<ByteStream> &gs
a9380a
       {
a9380a
          GP<File> file=files_list[pos];
a9380a
 
a9380a
+         if (ptr >= (const char*)strings + strings_size)
a9380a
+           G_THROW( "DjVu document is corrupted (DjVmDir)" );
a9380a
          file->id=ptr;
a9380a
          ptr+=file->id.length()+1;
a9380a
          if (file->flags & File::HAS_NAME)