mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
🐛Correct trying to read past partition when El Torito boot image indicates to be bigger than it.
This commit is contained in:
@@ -187,6 +187,7 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
pvd = (PrimaryVolumeDescriptor)Marshal.PtrToStructure(ptr, typeof(PrimaryVolumeDescriptor));
|
pvd = (PrimaryVolumeDescriptor)Marshal.PtrToStructure(ptr, typeof(PrimaryVolumeDescriptor));
|
||||||
Marshal.FreeHGlobal(ptr);
|
Marshal.FreeHGlobal(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
@@ -200,7 +201,8 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
// Check if this is Joliet
|
// Check if this is Joliet
|
||||||
if(svd.escape_sequences[0] == '%' && svd.escape_sequences[1] == '/')
|
if(svd.escape_sequences[0] == '%' && svd.escape_sequences[1] == '/')
|
||||||
if(svd.escape_sequences[2] == '@' || svd.escape_sequences[2] == 'C' ||
|
if(svd.escape_sequences[2] == '@' || svd.escape_sequences[2] == 'C' ||
|
||||||
svd.escape_sequences[2] == 'E') jolietvd = svd;
|
svd.escape_sequences[2] == 'E')
|
||||||
|
jolietvd = svd;
|
||||||
else
|
else
|
||||||
DicConsole.WriteLine("ISO9660 plugin", "Found unknown supplementary volume descriptor");
|
DicConsole.WriteLine("ISO9660 plugin", "Found unknown supplementary volume descriptor");
|
||||||
|
|
||||||
@@ -223,8 +225,10 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(highSierra) decodedVd = DecodeVolumeDescriptor(hsvd.Value);
|
if(highSierra) decodedVd = DecodeVolumeDescriptor(hsvd.Value);
|
||||||
else if(cdi) decodedVd = DecodeVolumeDescriptor(fsvd.Value);
|
else if(cdi)
|
||||||
else decodedVd = DecodeVolumeDescriptor(pvd.Value);
|
decodedVd = DecodeVolumeDescriptor(fsvd.Value);
|
||||||
|
else
|
||||||
|
decodedVd = DecodeVolumeDescriptor(pvd.Value);
|
||||||
|
|
||||||
if(jolietvd != null) decodedJolietVd = DecodeJolietDescriptor(jolietvd.Value);
|
if(jolietvd != null) decodedJolietVd = DecodeJolietDescriptor(jolietvd.Value);
|
||||||
|
|
||||||
@@ -366,16 +370,21 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rrip |= nextSignature == RRIP_MAGIC || nextSignature == RRIP_POSIX_ATTRIBUTES ||
|
rrip |= nextSignature == RRIP_MAGIC ||
|
||||||
nextSignature == RRIP_POSIX_DEV_NO || nextSignature == RRIP_SYMLINK ||
|
nextSignature == RRIP_POSIX_ATTRIBUTES ||
|
||||||
nextSignature == RRIP_NAME || nextSignature == RRIP_CHILDLINK ||
|
nextSignature == RRIP_POSIX_DEV_NO ||
|
||||||
nextSignature == RRIP_PARENTLINK || nextSignature == RRIP_RELOCATED_DIR ||
|
nextSignature == RRIP_SYMLINK ||
|
||||||
|
nextSignature == RRIP_NAME ||
|
||||||
|
nextSignature == RRIP_CHILDLINK ||
|
||||||
|
nextSignature == RRIP_PARENTLINK ||
|
||||||
|
nextSignature == RRIP_RELOCATED_DIR ||
|
||||||
nextSignature == RRIP_TIMESTAMPS || nextSignature == RRIP_SPARSE;
|
nextSignature == RRIP_TIMESTAMPS || nextSignature == RRIP_SPARSE;
|
||||||
|
|
||||||
ziso |= nextSignature == ZISO_MAGIC;
|
ziso |= nextSignature == ZISO_MAGIC;
|
||||||
amiga |= nextSignature == AMIGA_MAGIC;
|
amiga |= nextSignature == AMIGA_MAGIC;
|
||||||
aaip |= nextSignature == AAIP_MAGIC || nextSignature == AAIP_MAGIC_OLD &&
|
aaip |= nextSignature == AAIP_MAGIC || nextSignature == AAIP_MAGIC_OLD &&
|
||||||
sa[saOff + 3] == 1 && sa[saOff + 2] >= 9;
|
sa[saOff + 3] == 1 &&
|
||||||
|
sa[saOff + 2] >= 9;
|
||||||
|
|
||||||
saOff += sa[saOff + 2];
|
saOff += sa[saOff + 2];
|
||||||
|
|
||||||
@@ -449,9 +458,12 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
foreach(byte[] erb in refareas)
|
foreach(byte[] erb in refareas)
|
||||||
{
|
{
|
||||||
ReferenceArea er = BigEndianMarshal.ByteArrayToStructureBigEndian<ReferenceArea>(erb);
|
ReferenceArea er = BigEndianMarshal.ByteArrayToStructureBigEndian<ReferenceArea>(erb);
|
||||||
string extId = Encoding.GetString(erb, Marshal.SizeOf(er), er.id_len);
|
string extId =
|
||||||
string extDes = Encoding.GetString(erb, Marshal.SizeOf(er) + er.id_len, er.des_len);
|
Encoding.GetString(erb, Marshal.SizeOf(er), er.id_len);
|
||||||
string extSrc = Encoding.GetString(erb, Marshal.SizeOf(er) + er.id_len + er.des_len, er.src_len);
|
string extDes =
|
||||||
|
Encoding.GetString(erb, Marshal.SizeOf(er) + er.id_len, er.des_len);
|
||||||
|
string extSrc =
|
||||||
|
Encoding.GetString(erb, Marshal.SizeOf(er) + er.id_len + er.des_len, er.src_len);
|
||||||
suspInformation.AppendFormat("Extension: {0}", counter).AppendLine();
|
suspInformation.AppendFormat("Extension: {0}", counter).AppendLine();
|
||||||
suspInformation.AppendFormat("\tID: {0}, version {1}", extId, er.ext_ver).AppendLine();
|
suspInformation.AppendFormat("\tID: {0}, version {1}", extId, er.ext_ver).AppendLine();
|
||||||
suspInformation.AppendFormat("\tDescription: {0}", extDes).AppendLine();
|
suspInformation.AppendFormat("\tDescription: {0}", extDes).AppendLine();
|
||||||
@@ -467,8 +479,10 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
|
|
||||||
string fsFormat;
|
string fsFormat;
|
||||||
if(highSierra) fsFormat = "High Sierra Format";
|
if(highSierra) fsFormat = "High Sierra Format";
|
||||||
else if(cdi) fsFormat = "CD-i";
|
else if(cdi)
|
||||||
else fsFormat = "ISO9660";
|
fsFormat = "CD-i";
|
||||||
|
else
|
||||||
|
fsFormat = "ISO9660";
|
||||||
|
|
||||||
isoMetadata.AppendFormat("{0} file system", fsFormat).AppendLine();
|
isoMetadata.AppendFormat("{0} file system", fsFormat).AppendLine();
|
||||||
if(xaExtensions) isoMetadata.AppendLine("CD-ROM XA extensions present.");
|
if(xaExtensions) isoMetadata.AppendLine("CD-ROM XA extensions present.");
|
||||||
@@ -486,16 +500,19 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
isoMetadata.AppendLine("This is a SegaCD / MegaCD disc.");
|
isoMetadata.AppendLine("This is a SegaCD / MegaCD disc.");
|
||||||
isoMetadata.AppendLine(CD.Prettify(segaCd));
|
isoMetadata.AppendLine(CD.Prettify(segaCd));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(saturn != null)
|
if(saturn != null)
|
||||||
{
|
{
|
||||||
isoMetadata.AppendLine("This is a Sega Saturn disc.");
|
isoMetadata.AppendLine("This is a Sega Saturn disc.");
|
||||||
isoMetadata.AppendLine(Saturn.Prettify(saturn));
|
isoMetadata.AppendLine(Saturn.Prettify(saturn));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dreamcast != null)
|
if(dreamcast != null)
|
||||||
{
|
{
|
||||||
isoMetadata.AppendLine("This is a Sega Dreamcast disc.");
|
isoMetadata.AppendLine("This is a Sega Dreamcast disc.");
|
||||||
isoMetadata.AppendLine(Dreamcast.Prettify(dreamcast));
|
isoMetadata.AppendLine(Dreamcast.Prettify(dreamcast));
|
||||||
}
|
}
|
||||||
|
|
||||||
isoMetadata.AppendFormat("{0}------------------------------", cdi ? "---------------" : "").AppendLine();
|
isoMetadata.AppendFormat("{0}------------------------------", cdi ? "---------------" : "").AppendLine();
|
||||||
isoMetadata.AppendFormat("{0}VOLUME DESCRIPTOR INFORMATION:", cdi ? "FILE STRUCTURE " : "").AppendLine();
|
isoMetadata.AppendFormat("{0}VOLUME DESCRIPTOR INFORMATION:", cdi ? "FILE STRUCTURE " : "").AppendLine();
|
||||||
isoMetadata.AppendFormat("{0}------------------------------", cdi ? "---------------" : "").AppendLine();
|
isoMetadata.AppendFormat("{0}------------------------------", cdi ? "---------------" : "").AppendLine();
|
||||||
@@ -503,7 +520,8 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
isoMetadata.AppendFormat("Volume identifier: {0}", decodedVd.VolumeIdentifier).AppendLine();
|
isoMetadata.AppendFormat("Volume identifier: {0}", decodedVd.VolumeIdentifier).AppendLine();
|
||||||
isoMetadata.AppendFormat("Volume set identifier: {0}", decodedVd.VolumeSetIdentifier).AppendLine();
|
isoMetadata.AppendFormat("Volume set identifier: {0}", decodedVd.VolumeSetIdentifier).AppendLine();
|
||||||
isoMetadata.AppendFormat("Publisher identifier: {0}", decodedVd.PublisherIdentifier).AppendLine();
|
isoMetadata.AppendFormat("Publisher identifier: {0}", decodedVd.PublisherIdentifier).AppendLine();
|
||||||
isoMetadata.AppendFormat("Data preparer identifier: {0}", decodedVd.DataPreparerIdentifier).AppendLine();
|
isoMetadata.AppendFormat("Data preparer identifier: {0}", decodedVd.DataPreparerIdentifier)
|
||||||
|
.AppendLine();
|
||||||
isoMetadata.AppendFormat("Application identifier: {0}", decodedVd.ApplicationIdentifier).AppendLine();
|
isoMetadata.AppendFormat("Application identifier: {0}", decodedVd.ApplicationIdentifier).AppendLine();
|
||||||
isoMetadata.AppendFormat("Volume creation date: {0}", decodedVd.CreationTime).AppendLine();
|
isoMetadata.AppendFormat("Volume creation date: {0}", decodedVd.CreationTime).AppendLine();
|
||||||
if(decodedVd.HasModificationTime)
|
if(decodedVd.HasModificationTime)
|
||||||
@@ -527,7 +545,8 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
isoMetadata.AppendFormat("Volume identifier: {0}", decodedJolietVd.VolumeIdentifier).AppendLine();
|
isoMetadata.AppendFormat("Volume identifier: {0}", decodedJolietVd.VolumeIdentifier).AppendLine();
|
||||||
isoMetadata.AppendFormat("Volume set identifier: {0}", decodedJolietVd.VolumeSetIdentifier)
|
isoMetadata.AppendFormat("Volume set identifier: {0}", decodedJolietVd.VolumeSetIdentifier)
|
||||||
.AppendLine();
|
.AppendLine();
|
||||||
isoMetadata.AppendFormat("Publisher identifier: {0}", decodedJolietVd.PublisherIdentifier).AppendLine();
|
isoMetadata.AppendFormat("Publisher identifier: {0}", decodedJolietVd.PublisherIdentifier)
|
||||||
|
.AppendLine();
|
||||||
isoMetadata.AppendFormat("Data preparer identifier: {0}", decodedJolietVd.DataPreparerIdentifier)
|
isoMetadata.AppendFormat("Data preparer identifier: {0}", decodedJolietVd.DataPreparerIdentifier)
|
||||||
.AppendLine();
|
.AppendLine();
|
||||||
isoMetadata.AppendFormat("Application identifier: {0}", decodedJolietVd.ApplicationIdentifier)
|
isoMetadata.AppendFormat("Application identifier: {0}", decodedJolietVd.ApplicationIdentifier)
|
||||||
@@ -573,8 +592,16 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
Marshal.FreeHGlobal(ptr);
|
Marshal.FreeHGlobal(ptr);
|
||||||
initialEntry.boot_type = (ElToritoEmulation)((byte)initialEntry.boot_type & 0xF);
|
initialEntry.boot_type = (ElToritoEmulation)((byte)initialEntry.boot_type & 0xF);
|
||||||
|
|
||||||
|
DicConsole.DebugWriteLine("DEBUG (ISO9660 plugin)", "initialEntry.load_rba = {0}",
|
||||||
|
initialEntry.load_rba);
|
||||||
|
DicConsole.DebugWriteLine("DEBUG (ISO9660 plugin)", "initialEntry.sector_count = {0}",
|
||||||
|
initialEntry.sector_count);
|
||||||
|
|
||||||
byte[] bootImage =
|
byte[] bootImage =
|
||||||
imagePlugin.ReadSectors(initialEntry.load_rba + partition.Start, initialEntry.sector_count);
|
initialEntry.load_rba + partition.Start + initialEntry.sector_count -
|
||||||
|
1 <= partition.End
|
||||||
|
? imagePlugin.ReadSectors(initialEntry.load_rba + partition.Start, initialEntry.sector_count)
|
||||||
|
: null;
|
||||||
|
|
||||||
isoMetadata.AppendLine("----------------------");
|
isoMetadata.AppendLine("----------------------");
|
||||||
isoMetadata.AppendLine("EL TORITO INFORMATION:");
|
isoMetadata.AppendLine("EL TORITO INFORMATION:");
|
||||||
@@ -615,6 +642,7 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
}
|
}
|
||||||
|
|
||||||
isoMetadata.AppendFormat("\tSystem type: 0x{0:X2}", initialEntry.system_type).AppendLine();
|
isoMetadata.AppendFormat("\tSystem type: 0x{0:X2}", initialEntry.system_type).AppendLine();
|
||||||
|
if(bootImage != null)
|
||||||
isoMetadata.AppendFormat("\tBootable image's SHA1: {0}", sha1Ctx.Data(bootImage, out _))
|
isoMetadata.AppendFormat("\tBootable image's SHA1: {0}", sha1Ctx.Data(bootImage, out _))
|
||||||
.AppendLine();
|
.AppendLine();
|
||||||
}
|
}
|
||||||
@@ -624,7 +652,8 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
|
|
||||||
const int SECTION_COUNTER = 2;
|
const int SECTION_COUNTER = 2;
|
||||||
|
|
||||||
while(toritoOff < vdSector.Length && (vdSector[toritoOff] == (byte)ElToritoIndicator.Header ||
|
while(toritoOff < vdSector.Length &&
|
||||||
|
(vdSector[toritoOff] == (byte)ElToritoIndicator.Header ||
|
||||||
vdSector[toritoOff] == (byte)ElToritoIndicator.LastHeader))
|
vdSector[toritoOff] == (byte)ElToritoIndicator.LastHeader))
|
||||||
{
|
{
|
||||||
ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE);
|
ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE);
|
||||||
@@ -651,8 +680,13 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
isoMetadata.AppendFormat("\tEntry {0}:", entryCounter);
|
isoMetadata.AppendFormat("\tEntry {0}:", entryCounter);
|
||||||
if(sectionEntry.bootable == ElToritoIndicator.Bootable)
|
if(sectionEntry.bootable == ElToritoIndicator.Bootable)
|
||||||
{
|
{
|
||||||
bootImage = imagePlugin.ReadSectors(sectionEntry.load_rba + partition.Start,
|
bootImage =
|
||||||
sectionEntry.sector_count);
|
sectionEntry.load_rba + partition.Start +
|
||||||
|
sectionEntry.sector_count - 1 <= partition.End
|
||||||
|
? imagePlugin.ReadSectors(sectionEntry.load_rba + partition.Start,
|
||||||
|
sectionEntry.sector_count)
|
||||||
|
: null;
|
||||||
|
|
||||||
isoMetadata.AppendFormat("\t\tBootable on {0}", sectionHeader.platform_id).AppendLine();
|
isoMetadata.AppendFormat("\t\tBootable on {0}", sectionHeader.platform_id).AppendLine();
|
||||||
isoMetadata.AppendFormat("\t\tBootable image starts at sector {0} and runs for {1} sectors",
|
isoMetadata.AppendFormat("\t\tBootable image starts at sector {0} and runs for {1} sectors",
|
||||||
sectionEntry.load_rba, sectionEntry.sector_count).AppendLine();
|
sectionEntry.load_rba, sectionEntry.sector_count).AppendLine();
|
||||||
@@ -690,8 +724,9 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
sectionEntry.selection_criteria_type).AppendLine();
|
sectionEntry.selection_criteria_type).AppendLine();
|
||||||
isoMetadata.AppendFormat("\t\tSystem type: 0x{0:X2}", sectionEntry.system_type)
|
isoMetadata.AppendFormat("\t\tSystem type: 0x{0:X2}", sectionEntry.system_type)
|
||||||
.AppendLine();
|
.AppendLine();
|
||||||
isoMetadata.AppendFormat("\t\tBootable image's SHA1: {0}", sha1Ctx.Data(bootImage, out _))
|
if(bootImage != null)
|
||||||
.AppendLine();
|
isoMetadata.AppendFormat("\t\tBootable image's SHA1: {0}",
|
||||||
|
sha1Ctx.Data(bootImage, out _)).AppendLine();
|
||||||
}
|
}
|
||||||
else isoMetadata.AppendLine("\t\tNot bootable");
|
else isoMetadata.AppendLine("\t\tNot bootable");
|
||||||
|
|
||||||
@@ -761,11 +796,13 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
XmlFsType.ModificationDate = decodedJolietVd.ModificationTime;
|
XmlFsType.ModificationDate = decodedJolietVd.ModificationTime;
|
||||||
XmlFsType.ModificationDateSpecified = true;
|
XmlFsType.ModificationDateSpecified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(decodedJolietVd.HasExpirationTime)
|
if(decodedJolietVd.HasExpirationTime)
|
||||||
{
|
{
|
||||||
XmlFsType.ExpirationDate = decodedJolietVd.ExpirationTime;
|
XmlFsType.ExpirationDate = decodedJolietVd.ExpirationTime;
|
||||||
XmlFsType.ExpirationDateSpecified = true;
|
XmlFsType.ExpirationDateSpecified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(decodedJolietVd.HasEffectiveTime)
|
if(decodedJolietVd.HasEffectiveTime)
|
||||||
{
|
{
|
||||||
XmlFsType.EffectiveDate = decodedJolietVd.EffectiveTime;
|
XmlFsType.EffectiveDate = decodedJolietVd.EffectiveTime;
|
||||||
@@ -787,11 +824,13 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
XmlFsType.ModificationDate = decodedVd.ModificationTime;
|
XmlFsType.ModificationDate = decodedVd.ModificationTime;
|
||||||
XmlFsType.ModificationDateSpecified = true;
|
XmlFsType.ModificationDateSpecified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(decodedVd.HasExpirationTime)
|
if(decodedVd.HasExpirationTime)
|
||||||
{
|
{
|
||||||
XmlFsType.ExpirationDate = decodedVd.ExpirationTime;
|
XmlFsType.ExpirationDate = decodedVd.ExpirationTime;
|
||||||
XmlFsType.ExpirationDateSpecified = true;
|
XmlFsType.ExpirationDateSpecified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(decodedVd.HasEffectiveTime)
|
if(decodedVd.HasEffectiveTime)
|
||||||
{
|
{
|
||||||
XmlFsType.EffectiveDate = decodedVd.EffectiveTime;
|
XmlFsType.EffectiveDate = decodedVd.EffectiveTime;
|
||||||
|
|||||||
Reference in New Issue
Block a user