Added verification trough the isValid method of the chunck

This commit is contained in:
2022-09-26 09:08:11 +02:00
parent 35cba21842
commit 2362a7041c
2 changed files with 6 additions and 5 deletions

View File

@@ -80,7 +80,7 @@ namespace TEST_DecodePng
private void btnDecode_Click(object sender, EventArgs e)
{
PngDecoder decoder = new PngDecoder();
/*
try{
decoder.Decode(selectedFile);
}
@@ -88,10 +88,7 @@ namespace TEST_DecodePng
{
MessageBox.Show(ex.Message);
}
*/
decoder.Decode(selectedFile);
//decoder.Decode(selectedFile);
}
}
}

View File

@@ -162,6 +162,10 @@ namespace TEST_DecodePng
chunckCursor++;
header = new PngMetaData(imageHeight, imageWidth, (sbyte)bitDepth, (sbyte)colorType, (sbyte)compressionMethod, (sbyte)filterMethod, (sbyte)interlaceMethod);
if (!header.IsValid())
throw new InvalidPngHeadersFileException("Header invalide");
break;
default:
break;