Skip to content

Commit

Permalink
Add memory annotation in iccjpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
vrabaud committed Jan 17, 2025
1 parent 3805532 commit 363ca38
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions third_party/iccjpeg/iccjpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@
#include "iccjpeg.h"
#include <stdlib.h> /* define malloc() */

#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
#if !defined(AVIF_ANNOTATE_MEMORY_IS_INITIALIZED)
#define AVIF_ANNOTATE_MEMORY_IS_INITIALIZED(address, size) \
do { \
} while (0)
#endif

/*
* Since an ICC profile can be larger than the maximum size of a JPEG marker
Expand Down Expand Up @@ -123,6 +134,9 @@ setup_read_icc_profile (j_decompress_ptr cinfo)
static boolean
marker_is_icc (jpeg_saved_marker_ptr marker)
{
AVIF_ANNOTATE_MEMORY_IS_INITIALIZED(marker, sizeof(*marker));
if (marker->marker == ICC_MARKER && marker->data_length >= ICC_OVERHEAD_LEN)
AVIF_ANNOTATE_MEMORY_IS_INITIALIZED(marker->data, marker->data_length);
return
marker->marker == ICC_MARKER &&
marker->data_length >= ICC_OVERHEAD_LEN &&
Expand Down

0 comments on commit 363ca38

Please sign in to comment.