fix: Wrong keyword encoding, bad buffer, update cache fix

Was using ASCII for keyword and was generating inconsistent CRC whoops
This commit is contained in:
Teacup
2025-08-08 17:57:55 -07:00
committed by Natsumi
parent 06e06a7164
commit 7fe8f4e079
4 changed files with 23 additions and 17 deletions

View File

@@ -60,7 +60,7 @@ public class PNGFile : IDisposable
public PNGChunk? GetChunkReverse(PNGChunkTypeFilter chunkTypeFilter)
{
var chunk = ReadChunkReverse(chunkTypeFilter);
if (chunk.HasValue &&chunk.Value.IsZero())
if (chunk != null && chunk.IsZero())
return null;
return chunk;
@@ -147,10 +147,10 @@ public class PNGFile : IDisposable
}
fileStream.SetLength(fileStream.Length - deleteLength);
metadataChunkCache.Remove(chunk);
// update the index of all cached chunks
// Update the index of cached chunks
for (int i = 0; i < metadataChunkCache.Count; i++)
{
var cachedChunk = metadataChunkCache[i];