diff -rup linux-2.6.5-7.97/fs/isofs/inode.c linux-2.6.5-7.97.devel/fs/isofs/inode.c --- linux-2.6.5-7.97/fs/isofs/inode.c 2004-07-02 10:41:26.000000000 -0400 +++ linux-2.6.5-7.97.devel/fs/isofs/inode.c 2004-08-10 13:26:51.796563112 -0400 @@ -1158,7 +1158,7 @@ static int isofs_read_level3_size(struct de = tmpde; } - inode->i_size += isonum_733(de->size); + inode->i_size += (unsigned)isonum_733(de->size); if (i == 1) ei->i_next_section_ino = f_pos; @@ -1267,23 +1267,25 @@ static void isofs_read_inode(struct inod ei->i_format_parm[1] = 0; ei->i_format_parm[2] = 0; - ei->i_section_size = isonum_733 (de->size); + ei->i_section_size = (unsigned)isonum_733 (de->size); if(de->flags[-high_sierra] & 0x80) { if(isofs_read_level3_size(inode)) goto fail; } else { ei->i_next_section_ino = 0; - inode->i_size = isonum_733 (de->size); + inode->i_size = (unsigned)isonum_733 (de->size); } - /* - * The ISO-9660 filesystem only stores 32 bits for file size. - * mkisofs handles files up to 2GB-2 = 2147483646 = 0x7FFFFFFE bytes - * in size. This is according to the large file summit paper from 1996. - * WARNING: ISO-9660 filesystems > 1 GB and even > 2 GB are fully - * legal. Do not prevent to use DVD's schilling@fokus.gmd.de - */ + /* The ISO-9660 filesystem only stores 32 bits for file size. + * mkisofs handles files up to 4 GB-1 = 0xFFFFFFFF bytes in size. + * There used to be issues with some implementations hijacking the + * high byte of the size field for some other purpose. In order to + * allow for the full range of file sizes, yet still protect against + * this, we check and see if the file size is larger than the size + * of the entire volume. + */ if ((inode->i_size < 0 || inode->i_size > 0x7FFFFFFE) && - sbi->s_cruft == 'n') { + inode->i_size > (ISOFS_SB(sb)->s_nzones << + ISOFS_SB(sb)->s_log_zone_size) && sbi->s_cruft == 'n') { printk(KERN_WARNING "Warning: defective CD-ROM. " "Enabling \"cruft\" mount option.\n"); sbi->s_cruft = 'y';