mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
🐛Correct bug on writing of DC42.
This commit is contained in:
@@ -795,8 +795,8 @@ namespace DiscImageChef.DiscImages
|
|||||||
|
|
||||||
public bool Create(string path, MediaType mediaType, Dictionary<string, string> options, ulong sectors)
|
public bool Create(string path, MediaType mediaType, Dictionary<string, string> options, ulong sectors)
|
||||||
{
|
{
|
||||||
header = new Dc42Header();
|
header = new Dc42Header();
|
||||||
bool tags = false;
|
bool tags = false;
|
||||||
bool macosx = false;
|
bool macosx = false;
|
||||||
|
|
||||||
if(options != null && options.TryGetValue("macosx", out string tmpOption))
|
if(options != null && options.TryGetValue("macosx", out string tmpOption))
|
||||||
@@ -920,6 +920,7 @@ namespace DiscImageChef.DiscImages
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IsWriting = true;
|
||||||
ErrorMessage = null;
|
ErrorMessage = null;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -938,6 +939,12 @@ namespace DiscImageChef.DiscImages
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(data.Length != 512)
|
||||||
|
{
|
||||||
|
ErrorMessage = "Incorrect data size";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(sectorAddress >= sectorsToWrite)
|
if(sectorAddress >= sectorsToWrite)
|
||||||
{
|
{
|
||||||
ErrorMessage = "Tried to write past image size";
|
ErrorMessage = "Tried to write past image size";
|
||||||
@@ -959,19 +966,13 @@ namespace DiscImageChef.DiscImages
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data.Length != 512)
|
|
||||||
{
|
|
||||||
ErrorMessage = "Incorrect data size";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(data.Length % 512 != 0)
|
if(data.Length % 512 != 0)
|
||||||
{
|
{
|
||||||
ErrorMessage = "Incorrect data size";
|
ErrorMessage = "Incorrect data size";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sectorAddress + length >= sectorsToWrite)
|
if(sectorAddress + length > sectorsToWrite)
|
||||||
{
|
{
|
||||||
ErrorMessage = "Tried to write past image size";
|
ErrorMessage = "Tried to write past image size";
|
||||||
return false;
|
return false;
|
||||||
@@ -1039,7 +1040,7 @@ namespace DiscImageChef.DiscImages
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sectorAddress + length >= sectorsToWrite)
|
if(sectorAddress + length > sectorsToWrite)
|
||||||
{
|
{
|
||||||
ErrorMessage = "Tried to write past image size";
|
ErrorMessage = "Tried to write past image size";
|
||||||
return false;
|
return false;
|
||||||
@@ -1073,6 +1074,9 @@ namespace DiscImageChef.DiscImages
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No tags where written
|
||||||
|
if(writingStream.Length == 0x54 + header.DataSize) header.TagSize = 0;
|
||||||
|
|
||||||
writingStream.Seek(0x54, SeekOrigin.Begin);
|
writingStream.Seek(0x54, SeekOrigin.Begin);
|
||||||
byte[] data = new byte[header.DataSize];
|
byte[] data = new byte[header.DataSize];
|
||||||
writingStream.Read(data, 0, (int)header.DataSize);
|
writingStream.Read(data, 0, (int)header.DataSize);
|
||||||
|
|||||||
Reference in New Issue
Block a user