If pdf is truncated the length became negative (endstream before stream).
Make sure this doesn't happen.
... | ... |
@@ -124,6 +124,8 @@ static int find_stream_bounds(const char *start, off_t bytesleft, off_t byteslef |
124 | 124 |
if (!q2) |
125 | 125 |
q2 = q + bytesleft2-9; /* till EOF */ |
126 | 126 |
*endstream = q2 - start; |
127 |
+ if (*endstream < *stream) |
|
128 |
+ *endstream = *stream; |
|
127 | 129 |
return 1; |
128 | 130 |
} |
129 | 131 |
return 0; |