Skip to content

Commit

Permalink
Add msan unpoison for AOM
Browse files Browse the repository at this point in the history
  • Loading branch information
vrabaud committed Jan 13, 2025
1 parent 1e2ff2c commit 4c39aae
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/codec_aom.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@
#endif
#endif

#if defined(__clang__) && defined(__has_feature)
#if __has_feature(memory_sanitizer)
#include <sanitizer/msan_interface.h>
#define AVIF_ANNOTATE_MEMORY_IS_INITIALIZED(address, size) \
__msan_unpoison(address, size)
#endif
#endif
#ifndef AVIF_ANNOTATE_MEMORY_IS_INITIALIZED
#define AVIF_ANNOTATE_MEMORY_IS_INITIALIZED(address, size) do { } while(0)
#endif

struct avifCodecInternal
{
#if defined(AVIF_CODEC_AOM_DECODE)
Expand Down Expand Up @@ -1144,6 +1155,7 @@ static avifResult aomCodecEncodeImage(avifCodec * codec,
break;
}
if (pkt->kind == AOM_CODEC_CX_FRAME_PKT) {
AVIF_ANNOTATE_MEMORY_IS_INITIALIZED(pkt->data.frame.buf, pkt->data.frame.sz);
AVIF_CHECKRES(
avifCodecEncodeOutputAddSample(output, pkt->data.frame.buf, pkt->data.frame.sz, (pkt->data.frame.flags & AOM_FRAME_IS_KEY)));
}
Expand Down

0 comments on commit 4c39aae

Please sign in to comment.