Skip to content

Commit 89d71b0

Browse files
committed
fix hongfuzz crash.
1 parent 44596e0 commit 89d71b0

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

libdjvu/DjVmDir.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,13 @@ DjVmDir::decode(const GP<ByteStream> &gstr)
299299
memcpy((char*) strings+strings_size, buffer, length);
300300
}
301301
DEBUG_MSG("size of decompressed names block=" << strings.size() << "\n");
302-
302+
if (strings[strings.size()-1] != 0)
303+
{
304+
int strings_size=strings.size();
305+
strings.resize(strings_size+1);
306+
strings[strings_size] = 0;
307+
}
308+
303309
// Copy names into the files
304310
const char * ptr=strings;
305311
for(pos=files_list;pos;++pos)

libdjvu/miniexp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@ print_c_string(const char *s, char *d, int flags, size_t len)
10651065
c = (unsigned char)(*s++);
10661066
if (char_quoted(c, flags))
10671067
{
1068-
char buffer[10];
1068+
char buffer[16]; /* 10+1 */
10691069
static const char *tr1 = "\"\\tnrbf";
10701070
static const char *tr2 = "\"\\\t\n\r\b\f";
10711071
buffer[0] = buffer[1] = 0;

tools/csepdjvu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1834,7 +1834,7 @@ main(int argc, const char **argv)
18341834
ByteStream::create(GURL::Filename::UTF8(arg),"rb");
18351835
BufferByteStream ibs(*fbs);
18361836
do {
1837-
char pagename[16];
1837+
char pagename[20];
18381838
sprintf(pagename, "p%04d.djvu", ++pageno);
18391839
if (opts.verbose > 1)
18401840
DjVuPrintErrorUTF8("%s","--------------------\n");

0 commit comments

Comments
 (0)