Show More
@@ -39,6 +39,7 b' typedef struct {' | |||
|
39 | 39 | #define MANIFEST_NOT_SORTED -2 |
|
40 | 40 | #define MANIFEST_MALFORMED -3 |
|
41 | 41 | #define MANIFEST_BOGUS_FILENAME -4 |
|
42 | #define MANIFEST_TOO_SHORT_LINE -5 | |
|
42 | 43 | |
|
43 | 44 | /* get the length of the path for a line */ |
|
44 | 45 | static size_t pathlen(line *l) |
@@ -126,6 +127,15 b' static int find_lines(lazymanifest *self' | |||
|
126 | 127 | if (!next) { |
|
127 | 128 | return MANIFEST_MALFORMED; |
|
128 | 129 | } |
|
130 | if ((next - data) < 22) { | |
|
131 | /* We should have at least 22 bytes in a line: | |
|
132 | 1 byte filename | |
|
133 | 1 NUL | |
|
134 | 20 bytes of hash | |
|
135 | so we can give up here. | |
|
136 | */ | |
|
137 | return MANIFEST_TOO_SHORT_LINE; | |
|
138 | } | |
|
129 | 139 | next++; /* advance past newline */ |
|
130 | 140 | if (!realloc_if_full(self)) { |
|
131 | 141 | return MANIFEST_OOM; /* no memory */ |
@@ -202,6 +212,11 b' static int lazymanifest_init(lazymanifes' | |||
|
202 | 212 | PyExc_ValueError, |
|
203 | 213 | "Manifest had an entry with a zero-length filename."); |
|
204 | 214 | break; |
|
215 | case MANIFEST_TOO_SHORT_LINE: | |
|
216 | PyErr_Format( | |
|
217 | PyExc_ValueError, | |
|
218 | "Manifest had implausibly-short line."); | |
|
219 | break; | |
|
205 | 220 | default: |
|
206 | 221 | PyErr_Format(PyExc_ValueError, |
|
207 | 222 | "Unknown problem parsing manifest."); |
General Comments 0
You need to be logged in to leave comments.
Login now