... | ... |
@@ -222,6 +222,10 @@ static int pefromupx (const char *src, uint32_t ssize, char *dst, uint32_t *dsiz |
222 | 222 |
cli_writeint32(sections+12, urva); |
223 | 223 |
cli_writeint32(sections+16, vsize); |
224 | 224 |
cli_writeint32(sections+20, foffset); |
225 |
+ if (foffset + vsize < foffset) { |
|
226 |
+ /* Integer overflow */ |
|
227 |
+ return 0; |
|
228 |
+ } |
|
225 | 229 |
foffset+=vsize; |
226 | 230 |
|
227 | 231 |
sections+=0x28; |