Skip to content

Commit 2df1b2c

Browse files
Wenxing-houliyi77
authored andcommitted
CryptoPkg: Fix CryptAuthenticode fuzz
Signed-off-by: Wenxing Hou <[email protected]>
1 parent f1afa77 commit 2df1b2c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

CryptoPkg/Library/BaseCryptLibMbedTls/Pk/CryptAuthenticode.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ AuthenticodeVerify (
7272
return FALSE;
7373
}
7474

75+
if (DataSize <= HashSize) {
76+
return FALSE;
77+
}
78+
7579
Ptr = (UINT8 *)(UINTN)AuthData;
7680
Len = (UINT32)DataSize;
7781
End = Ptr + Len;
@@ -188,6 +192,10 @@ AuthenticodeVerify (
188192
// defined in Authenticode
189193
// NOTE: Need to double-check HashLength here!
190194
//
195+
if (ContentSize < HashSize) {
196+
return FALSE;
197+
}
198+
191199
if (CompareMem (SpcIndirectDataContent + ContentSize - HashSize, ImageHash, HashSize) != 0) {
192200
//
193201
// Un-matched PE/COFF Hash Value

0 commit comments

Comments
 (0)