mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
* DiscImageChef.DiscImages/GDI.cs:
* DiscImageChef.DiscImages/CDRDAO.cs: * DiscImageChef.DiscImages/CDRWin.cs: Prevent reading binary files. * DiscImageChef.Filters/MacBinary.cs: Adds more sanity checks.
This commit is contained in:
@@ -244,7 +244,17 @@ namespace DiscImageChef.ImagePlugins
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin);
|
imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin);
|
||||||
tocStream = new StreamReader(imageFilter.GetDataForkStream());
|
byte[] testArray = new byte[512];
|
||||||
|
imageFilter.GetDataForkStream().Read(testArray, 0, 512);
|
||||||
|
imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin);
|
||||||
|
// Check for unexpected control characters that shouldn't be present in a text file and can crash this plugin
|
||||||
|
foreach(byte b in testArray)
|
||||||
|
{
|
||||||
|
if(b < 0x20 && b != 0x0A && b != 0x0D)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
tocStream = new StreamReader(imageFilter.GetDataForkStream());
|
||||||
string _line = tocStream.ReadLine();
|
string _line = tocStream.ReadLine();
|
||||||
|
|
||||||
Regex Dr = new Regex(DiskTypeRegEx);
|
Regex Dr = new Regex(DiskTypeRegEx);
|
||||||
|
|||||||
@@ -315,8 +315,18 @@ namespace DiscImageChef.ImagePlugins
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin);
|
imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin);
|
||||||
cueStream = new StreamReader(this.imageFilter.GetDataForkStream());
|
byte[] testArray = new byte[512];
|
||||||
|
imageFilter.GetDataForkStream().Read(testArray, 0, 512);
|
||||||
|
imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin);
|
||||||
|
// Check for unexpected control characters that shouldn't be present in a text file and can crash this plugin
|
||||||
|
foreach(byte b in testArray)
|
||||||
|
{
|
||||||
|
if(b < 0x20 && b != 0x0A && b != 0x0D)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cueStream = new StreamReader(this.imageFilter.GetDataForkStream());
|
||||||
int line = 0;
|
int line = 0;
|
||||||
|
|
||||||
while(cueStream.Peek() >= 0)
|
while(cueStream.Peek() >= 0)
|
||||||
|
|||||||
@@ -133,8 +133,17 @@ namespace DiscImageChef.ImagePlugins
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin);
|
imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin);
|
||||||
gdiStream = new StreamReader(imageFilter.GetDataForkStream());
|
byte[] testArray = new byte[512];
|
||||||
|
imageFilter.GetDataForkStream().Read(testArray, 0, 512);
|
||||||
|
imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin);
|
||||||
|
// Check for unexpected control characters that shouldn't be present in a text file and can crash this plugin
|
||||||
|
foreach(byte b in testArray)
|
||||||
|
{
|
||||||
|
if(b < 0x20 && b != 0x0A && b != 0x0D)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
gdiStream = new StreamReader(imageFilter.GetDataForkStream());
|
||||||
int line = 0;
|
int line = 0;
|
||||||
int tracksFound = 0;
|
int tracksFound = 0;
|
||||||
int tracks = 0;
|
int tracks = 0;
|
||||||
|
|||||||
42
DiscImageChef.Filesystems/FATX.cs
Normal file
42
DiscImageChef.Filesystems/FATX.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
// /***************************************************************************
|
||||||
|
// The Disc Image Chef
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : FATX.cs
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// Component : Component
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Description
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Lesser General Public License as
|
||||||
|
// published by the Free Software Foundation; either version 2.1 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful, but
|
||||||
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2011-2016 Natalia Portillo
|
||||||
|
// ****************************************************************************/
|
||||||
|
using System;
|
||||||
|
namespace DiscImageChef.Filesystems
|
||||||
|
{
|
||||||
|
public class FATX
|
||||||
|
{
|
||||||
|
public FATX()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -277,7 +277,8 @@ namespace DiscImageChef.Filters
|
|||||||
header = BigEndianMarshal.ByteArrayToStructureBigEndian<MacBinaryHeader>(hdr_b);
|
header = BigEndianMarshal.ByteArrayToStructureBigEndian<MacBinaryHeader>(hdr_b);
|
||||||
|
|
||||||
return header.magic == MacBinaryMagic || (header.version == 0 && header.filename[0] > 0 && header.filename[0] < 64 &&
|
return header.magic == MacBinaryMagic || (header.version == 0 && header.filename[0] > 0 && header.filename[0] < 64 &&
|
||||||
header.zero1 == 0 && header.zero2 == 0 && header.reserved == 0);
|
header.zero1 == 0 && header.zero2 == 0 && header.reserved == 0 && (
|
||||||
|
header.dataLength > 0 || header.resourceLength > 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Identify(Stream stream)
|
public override bool Identify(Stream stream)
|
||||||
@@ -291,7 +292,8 @@ namespace DiscImageChef.Filters
|
|||||||
header = BigEndianMarshal.ByteArrayToStructureBigEndian<MacBinaryHeader>(hdr_b);
|
header = BigEndianMarshal.ByteArrayToStructureBigEndian<MacBinaryHeader>(hdr_b);
|
||||||
|
|
||||||
return header.magic == MacBinaryMagic || (header.version == 0 && header.filename[0] > 0 && header.filename[0] < 64 &&
|
return header.magic == MacBinaryMagic || (header.version == 0 && header.filename[0] > 0 && header.filename[0] < 64 &&
|
||||||
header.zero1 == 0 && header.zero2 == 0 && header.reserved == 0);
|
header.zero1 == 0 && header.zero2 == 0 && header.reserved == 0 && (
|
||||||
|
header.dataLength > 0 || header.resourceLength > 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Identify(string path)
|
public override bool Identify(string path)
|
||||||
@@ -306,7 +308,8 @@ namespace DiscImageChef.Filters
|
|||||||
|
|
||||||
fstream.Close();
|
fstream.Close();
|
||||||
return header.magic == MacBinaryMagic || (header.version == 0 && header.filename[0] > 0 && header.filename[0] < 64 &&
|
return header.magic == MacBinaryMagic || (header.version == 0 && header.filename[0] > 0 && header.filename[0] < 64 &&
|
||||||
header.zero1 == 0 && header.zero2 == 0 && header.reserved == 0);
|
header.zero1 == 0 && header.zero2 == 0 && header.reserved == 0 && (
|
||||||
|
header.dataLength > 0 || header.resourceLength > 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsOpened()
|
public override bool IsOpened()
|
||||||
|
|||||||
42
DiscImageChef.Partitions/Xbox.cs
Normal file
42
DiscImageChef.Partitions/Xbox.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
// /***************************************************************************
|
||||||
|
// The Disc Image Chef
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : Xbox.cs
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// Component : Component
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Description
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Lesser General Public License as
|
||||||
|
// published by the Free Software Foundation; either version 2.1 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful, but
|
||||||
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2011-2016 Natalia Portillo
|
||||||
|
// ****************************************************************************/
|
||||||
|
using System;
|
||||||
|
namespace DiscImageChef.Partitions
|
||||||
|
{
|
||||||
|
public class Xbox
|
||||||
|
{
|
||||||
|
public Xbox()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user