Skip to content

Commit 2a5409b

Browse files
olszomalmtrojnar
authored andcommitted
Fix header bounds validation in PE page hash calculation
1 parent 87bce8e commit 2a5409b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ static u_char *pe_page_hash_calc(int *rphlen, FILE_FORMAT_CTX *ctx, int phtype)
10471047
return NULL; /* FAILED */
10481048
}
10491049
off = ctx->pe_ctx->header_size + 160 + (size_t)ctx->pe_ctx->pe32plus * 16;
1050-
if (hdrsize < off) {
1050+
if (hdrsize < off || hdrsize > filebound) {
10511051
BIO_free_all(bhash);
10521052
return NULL; /* FAILED: header too small */
10531053
}

0 commit comments

Comments
 (0)