Kai Kang
2014-Jun-20 03:32 UTC
[syslinux] [PATCH] isohybrid: fix overflow on 32 bit system
When call isohybrid with option '-u', it overflows on a 32 bits host. It seeks to 512 bytes before the end of the image to install gpt header. If the size of image is larger than LONG_MAX, it overflows fseek() and cause error: isohybrid: image-x86-64-20140505110100.iso: seek error - 8: Invalid argument Replace fseek with fseeko to fix this issue. Signed-off-by: Kai Kang <kai.kang at windriver.com> --- utils/isohybrid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/isohybrid.c b/utils/isohybrid.c index 410bb60..23fc6c0 100644 --- a/utils/isohybrid.c +++ b/utils/isohybrid.c @@ -1126,7 +1126,7 @@ main(int argc, char *argv[]) * end of the image */ - if (fseek(fp, (isostat.st_size + padding) - orig_gpt_size - 512, + if (fseeko(fp, (isostat.st_size + padding) - orig_gpt_size - 512, SEEK_SET)) err(1, "%s: seek error - 8", argv[0]); -- 1.9.1
> When call isohybrid with option '-u', it overflows on a 32 bits host. It > seeks to 512 bytes before the end of the image to install gpt header. If > the size of image is larger than LONG_MAX, it overflows fseek() and > cause error: > > isohybrid: image-x86-64-20140505110100.iso: seek error - 8: Invalid argument > > Replace fseek with fseeko to fix this issue. >The Perl variant, isohybrid.in, seems to be getting left behind regarding several patches. I don't recall whether there is at least some mention in the isohybrid docs about the existence of 2 variants included in Syslinux (and that is in addition to other isohybrid methods outside Syslinux). Is there any reference? Regards, Ady.
Op 2014-06-20 om 15:56 schreef Ady:> > The Perl variant, isohybrid.in, seems to be getting left behind > regarding several patches. I don't recall whether there is at least > some mention in the isohybrid docs about the existence of 2 variants > included in Syslinux (and that is in addition to other isohybrid > methods outside Syslinux). Is there any reference? >What I reminder from it: The first "isohybrid" was in perl. But that made perl a run-time dependency. A compiled version of "isohybrid" removed that run-time dependency on perl. What I think of it: The Perl variant of isohybrid should be removed from the source tree. What I have prepared: a patch. Groeten Geert Stappers -- Leven en laten leven
H. Peter Anvin
2014-Jun-23 20:49 UTC
[syslinux] [PATCH] isohybrid: fix overflow on 32 bit system
On 06/20/2014 05:56 AM, Ady wrote:> >> When call isohybrid with option '-u', it overflows on a 32 bits host. It >> seeks to 512 bytes before the end of the image to install gpt header. If >> the size of image is larger than LONG_MAX, it overflows fseek() and >> cause error: >> >> isohybrid: image-x86-64-20140505110100.iso: seek error - 8: Invalid argument >> >> Replace fseek with fseeko to fix this issue. >> > > The Perl variant, isohybrid.in, seems to be getting left behind > regarding several patches. I don't recall whether there is at least > some mention in the isohybrid docs about the existence of 2 variants > included in Syslinux (and that is in addition to other isohybrid > methods outside Syslinux). Is there any reference? >I don't know of any missing functionality in the Perl version, but perhaps I'm wrong. We can kill it if it is truly behind, but it does have the advantage of being platform-independent. The fseeko() fix applies to the C version only; the Perl runtime would contain this internally. -hpa