Skip to content

Commit 6826596

Browse files
authored
Merge pull request #2 from ballway/main
修正 PNG 的驗證
2 parents 8e6b226 + b568573 commit 6826596

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

FileExtensionValidation/FileExtensionValidator.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ public static class FileExtensionValidator
1010
{
1111
//https://en.wikipedia.org/wiki/List_of_file_signatures
1212
//https://www.filesignatures.net/index.php
13-
//https://www.garykessler.net/library/file_sigs.html
13+
//https://www.garykessler.net/library/file_sigs.html (作者已退休,於 2025 轉交 SEARCH 團隊維護 https://filesig.search.org/)
14+
//https://www.garykessler.net/library/file_sigs_GCK_latest.html
1415
//https://asecuritysite.com/forensics/magic
1516
private static Dictionary<string, List<(byte[] Signature, int Offset, int Skip, byte[] SecondSignature)>> fileSignature
1617
= new Dictionary<string, List<(byte[] Signature, int Offset, int Skip, byte[] SecondSignature)>>() {
@@ -30,11 +31,7 @@ public static class FileExtensionValidator
3031
(new byte[] { 0x57, 0x69, 0x6E, 0x5A, 0x69, 0x70 }, 0, 0, new byte[] { })
3132
}
3233
},
33-
{ ".PNG", new List<(byte[], int, int, byte[])> { (new byte[] { 0x89, 0x50, 0x4E, 0x47 }, 0, 0, new byte[] { }),
34-
(new byte[] { 0xFF, 0xD8, 0xFF, 0xE0 }, 0, 0, new byte[] { }),
35-
(new byte[] { 0xFF, 0xD8, 0xFF, 0xE1 }, 0, 0, new byte[] { }),
36-
(new byte[] { 0xFF, 0xD8, 0xFF, 0xE8 }, 0, 0, new byte[] { })
37-
} },
34+
{ ".PNG", new List<(byte[], int, int, byte[])> { (new byte[] { 0x89, 0x50, 0x4E, 0x47 }, 0, 0, new byte[] { })} },
3835
{ ".JPG", new List<(byte[], int, int, byte[])>
3936
{
4037
(new byte[] { 0xFF, 0xD8, 0xFF, 0xE0 }, 0, 0, new byte[] { }),

0 commit comments

Comments
 (0)