Closed j4587698 closed 4 months ago
I've changed the way pictures are read to rely on a read buffer instead of trying to read everything in one go.
You can control its size using ATL.Settings.FileBufferSize
.
Can you test using the source code or do you need a release?
I apologize for not noticing your reply earlier. I have now addressed the issue by using an intermediary stream. I think you can go ahead and release it directly.
Fix is available in today's v5.24. Please close the issue if it works on your side.
There still seems to be a problem with the test. Looking at the code, for instance around line 1079 in ID3v2.cs
, it appears that byte.Read is still being used.
int picSize = dataSize - (int)(source.Position - position);
byte[] data;
if (tag.UsesUnsynchronisation)
{
data = decodeUnsynchronizedStream(source, picSize);
}
else
{
data = new byte[picSize];
source.Read(data, 0, picSize);
}
PictureInfo picInfo = PictureInfo.fromBinaryData(data, picType, getImplementedTagType(), picCode, picturePosition);
picInfo.Description = description;
There still seems to be a problem with the test. Looking at the code, for instance around line 1079 in
ID3v2.cs
, it appears that byte.Read is still being used.
Sorry, I forgot about that one. Thanks for letting me know. The fix will be available in the next release 😅
Fix is available in today's v5.25. Please close the issue if it works on your side.
The problem
When the stream read speed is not very fast (such as reading from a network data stream), there may be an issue of incomplete reads if the byte read length is too long. During testing, when retrieving built-in images, a significant number of images were only partially read. Upon inspecting the source code, it was discovered that the program's reading process does not handle read lengths, and the code directly assumes a completed read with lines like source.Read(buffer, 0, buffer.Length);. When the stream is slow, this may result in only a portion of the content being read, leading to problems.
Environment
Details
Code To Reproduce Issue [ Good To Have ]
Please remember that with sample code it's easier to reproduce the bug and it's much faster to fix it.