use an exception instead of assert() for overlay checking (bug #1624840)

This commit is contained in:
László Molnár
2007-01-16 12:58:35 +01:00
parent f4a9815f48
commit 8f7c898c08
+2 -2
View File
@@ -546,8 +546,8 @@ void Packer::handleStub(InputFile *fif, OutputFile *fo, long size)
void Packer::checkOverlay(unsigned overlay) void Packer::checkOverlay(unsigned overlay)
{ {
assert((int)overlay >= 0); if ((int)overlay < 0 || (off_t)overlay > file_size)
assert((off_t)overlay < file_size); throw OverlayException("invalid overlay size; file is possibly corrupt");
if (overlay == 0) if (overlay == 0)
return; return;
info("Found overlay: %d bytes", overlay); info("Found overlay: %d bytes", overlay);