============================= LGPL licensed 7zip, UdfIn.cpp ============================= else if (tag.Id == DESC_TYPE_LogicalVol) { if (LogVols.Size() >= kNumLogVolumesMax) return S_FALSE; CLogVol vol; vol.Id.Parse(buf + 84); vol.BlockSize = Get32(buf + 212); // vol.DomainId.Parse(buf + 216); if (vol.BlockSize < 512 || vol.BlockSize > ((UInt32)1 << 30)) return S_FALSE; // memcpy(vol.ContentsUse, buf + 248, sizeof(vol.ContentsUse)); vol.FileSetLocation.Parse(buf + 248); // UInt32 mapTableLength = Get32(buf + 264); UInt32 numPartitionMaps = Get32(buf + 268); if (numPartitionMaps > kNumPartitionsMax) return S_FALSE; // vol.ImplId.Parse(buf + 272); // memcpy(vol.ImplUse, buf + 128, sizeof(vol.ImplUse)); size_t pos = 440; for (UInt32 i = 0; i < numPartitionMaps; i++) { if (pos + 2 > bufSize) return S_FALSE; CPartitionMap pm; pm.Type = buf[pos]; // pm.Length = buf[pos + 1]; Byte len = buf[pos + 1]; if (pos + len > bufSize) return S_FALSE; // memcpy(pm.Data, buf + pos + 2, pm.Length - 2); if (pm.Type == 1) { if (pos + 6 > bufSize) return S_FALSE; // pm.VolSeqNumber = Get16(buf + pos + 2); pm.PartitionNumber = Get16(buf + pos + 4); } else return S_FALSE; pos += len; vol.PartitionMaps.Add(pm); } LogVols.Add(vol); } } ====================================================== GPL licensed derivative work ImageMaster, UdfReader.cs ====================================================== else if (tag.Identifier == (int)VolumeDescriptorType.LogicalVolume) { if (LogicalVolumes.Count >= MaxLogicalVolumes) return false; LogicalVolume volume = new LogicalVolume(); volume.Id.Parse(84, buffer); volume.BlockSize = UdfHelper.Get32(212, buffer); if (volume.BlockSize < ImageReader.VIRTUAL_SECTOR_SIZE || volume.BlockSize > MaxExtents) return false; volume.FileSetLocation.Parse(248, buffer); int numPartitionMaps = UdfHelper.Get32(268, buffer); if (numPartitionMaps > MaxPartitions) return false; position = 440; for (int i = 0; i < numPartitionMaps; i++) { if (position + 2 > bufSize) return false; PartitionMap pm = new PartitionMap(); pm.Type = buffer[position]; byte length = buffer[position + 1]; if (position + length > bufSize) return false; if (pm.Type == 1) { if (position + 6 > bufSize) return false; pm.PartitionNumber = UdfHelper.Get16(position + 4, buffer); } else return false; position += length; volume.PartitionMaps.Add(pm); } LogicalVolumes.Add(volume); } ================================================== Microsoft licensed ISO tool, reflected source code ================================================== private bool ReadLogicalDescriptor(byte[] buffer) { LogicalVolume item = new LogicalVolume(); item.Id.Parse(84, buffer); item.BlockSize = UdfHelper.Get32(212, buffer); if ((item.BlockSize < 512) || (item.BlockSize > 1073741824)) { return false; } item.FileSetLocation.Parse(248, buffer); int num = UdfHelper.Get32(268, buffer); if (num > 64) { return false; } int index = 440; for (int i = 0; i < num; i++) { if ((index + 2) > 2048) { return false; } PartitionMap map = new PartitionMap(); map.Type = buffer[index]; byte num4 = buffer[index + 1]; if ((index + num4) > 2048) { return false; } if (map.Type != 1) { return false; } if ((index + 6) > 2048) { return false; } map.PartitionNumber = UdfHelper.Get16(index + 4, buffer); index += num4; map.PartitionIndex = item.PartitionMaps.Count; item.PartitionMaps.Add(map); } this.LogicalVolumes.Add(item); return true; }