Skip to content

Commit

Permalink
detect: do not upgrade base64 decode when fuzzing
Browse files Browse the repository at this point in the history
As fuzzing will put a very big value, and then
ThreadCtxDoInit will try to allocate it,
ending in out of memory
  • Loading branch information
catenacyber authored and victorjulien committed Jan 18, 2022
1 parent ca29d33 commit 23fb139
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/detect-base64-decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ static int DetectBase64DecodeSetup(DetectEngineCtx *de_ctx, Signature *s,
data->bytes = BASE64_DECODE_MAX;
}
if (data->bytes > de_ctx->base64_decode_max_len) {
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
data->bytes = BASE64_DECODE_MAX;
#endif
de_ctx->base64_decode_max_len = data->bytes;
}

Expand Down

0 comments on commit 23fb139

Please sign in to comment.