Coverage Report

Created: 2026-07-16 07:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/flac/include/share/alloc.h
Line
Count
Source
1
/* alloc - Convenience routines for safely allocating memory
2
 * Copyright (C) 2007-2009  Josh Coalson
3
 * Copyright (C) 2011-2025  Xiph.Org Foundation
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 *
9
 * - Redistributions of source code must retain the above copyright
10
 * notice, this list of conditions and the following disclaimer.
11
 *
12
 * - Redistributions in binary form must reproduce the above copyright
13
 * notice, this list of conditions and the following disclaimer in the
14
 * documentation and/or other materials provided with the distribution.
15
 *
16
 * - Neither the name of the Xiph.org Foundation nor the names of its
17
 * contributors may be used to endorse or promote products derived from
18
 * this software without specific prior written permission.
19
 *
20
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
 * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
24
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
 */
32
33
#ifndef FLAC__SHARE__ALLOC_H
34
#define FLAC__SHARE__ALLOC_H
35
36
#ifdef HAVE_CONFIG_H
37
#  include <config.h>
38
#endif
39
40
/* WATCHOUT: for c++ you may have to #define __STDC_LIMIT_MACROS 1 real early
41
 * before #including this file,  otherwise SIZE_MAX might not be defined
42
 */
43
44
#include <limits.h> /* for SIZE_MAX */
45
#ifdef HAVE_STDINT_H
46
#include <stdint.h> /* for SIZE_MAX in case limits.h didn't get it */
47
#endif
48
#include <stdlib.h> /* for size_t, malloc(), etc */
49
#include "share/compat.h"
50
51
#ifndef SIZE_MAX
52
# ifndef SIZE_T_MAX
53
#  ifdef _MSC_VER
54
#   ifdef _WIN64
55
#    define SIZE_T_MAX FLAC__U64L(0xffffffffffffffff)
56
#   else
57
#    define SIZE_T_MAX 0xffffffff
58
#   endif
59
#  else
60
#   error
61
#  endif
62
# endif
63
# define SIZE_MAX SIZE_T_MAX
64
#endif
65
66
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
67
68
extern int alloc_check_threshold, alloc_check_counter, alloc_check_keep_failing;
69
70
626k
static inline int alloc_check(void) {
71
626k
  if(alloc_check_threshold == INT32_MAX)
72
626k
    return 0;
73
0
  else if(alloc_check_counter++ == alloc_check_threshold)
74
0
    return 1;
75
0
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
0
  else {
78
0
    return 0;
79
0
  }
80
626k
}
operations.c:alloc_check
Line
Count
Source
70
5.27k
static inline int alloc_check(void) {
71
5.27k
  if(alloc_check_threshold == INT32_MAX)
72
5.27k
    return 0;
73
0
  else if(alloc_check_counter++ == alloc_check_threshold)
74
0
    return 1;
75
0
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
0
  else {
78
0
    return 0;
79
0
  }
80
5.27k
}
options.c:alloc_check
Line
Count
Source
70
6
static inline int alloc_check(void) {
71
6
  if(alloc_check_threshold == INT32_MAX)
72
6
    return 0;
73
0
  else if(alloc_check_counter++ == alloc_check_threshold)
74
0
    return 1;
75
0
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
0
  else {
78
0
    return 0;
79
0
  }
80
6
}
utils.c:alloc_check
Line
Count
Source
70
29.3k
static inline int alloc_check(void) {
71
29.3k
  if(alloc_check_threshold == INT32_MAX)
72
29.3k
    return 0;
73
0
  else if(alloc_check_counter++ == alloc_check_threshold)
74
0
    return 1;
75
0
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
0
  else {
78
0
    return 0;
79
0
  }
80
29.3k
}
Unexecuted instantiation: utf8.c:alloc_check
iconvert.c:alloc_check
Line
Count
Source
70
38.2k
static inline int alloc_check(void) {
71
38.2k
  if(alloc_check_threshold == INT32_MAX)
72
38.2k
    return 0;
73
0
  else if(alloc_check_counter++ == alloc_check_threshold)
74
0
    return 1;
75
0
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
0
  else {
78
0
    return 0;
79
0
  }
80
38.2k
}
Unexecuted instantiation: alloc.c:alloc_check
picture.c:alloc_check
Line
Count
Source
70
4.33k
static inline int alloc_check(void) {
71
4.33k
  if(alloc_check_threshold == INT32_MAX)
72
4.33k
    return 0;
73
0
  else if(alloc_check_counter++ == alloc_check_threshold)
74
0
    return 1;
75
0
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
0
  else {
78
0
    return 0;
79
0
  }
80
4.33k
}
replaygain_analysis.c:alloc_check
Line
Count
Source
70
44.8k
static inline int alloc_check(void) {
71
44.8k
  if(alloc_check_threshold == INT32_MAX)
72
44.8k
    return 0;
73
0
  else if(alloc_check_counter++ == alloc_check_threshold)
74
0
    return 1;
75
0
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
0
  else {
78
0
    return 0;
79
0
  }
80
44.8k
}
format.c:alloc_check
Line
Count
Source
70
19.3k
static inline int alloc_check(void) {
71
19.3k
  if(alloc_check_threshold == INT32_MAX)
72
19.3k
    return 0;
73
0
  else if(alloc_check_counter++ == alloc_check_threshold)
74
0
    return 1;
75
0
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
0
  else {
78
0
    return 0;
79
0
  }
80
19.3k
}
metadata_iterators.c:alloc_check
Line
Count
Source
70
110k
static inline int alloc_check(void) {
71
110k
  if(alloc_check_threshold == INT32_MAX)
72
110k
    return 0;
73
0
  else if(alloc_check_counter++ == alloc_check_threshold)
74
0
    return 1;
75
0
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
0
  else {
78
0
    return 0;
79
0
  }
80
110k
}
metadata_object.c:alloc_check
Line
Count
Source
70
129k
static inline int alloc_check(void) {
71
129k
  if(alloc_check_threshold == INT32_MAX)
72
129k
    return 0;
73
0
  else if(alloc_check_counter++ == alloc_check_threshold)
74
0
    return 1;
75
0
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
0
  else {
78
0
    return 0;
79
0
  }
80
129k
}
stream_decoder.c:alloc_check
Line
Count
Source
70
190k
static inline int alloc_check(void) {
71
190k
  if(alloc_check_threshold == INT32_MAX)
72
190k
    return 0;
73
0
  else if(alloc_check_counter++ == alloc_check_threshold)
74
0
    return 1;
75
0
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
0
  else {
78
0
    return 0;
79
0
  }
80
190k
}
Unexecuted instantiation: ogg_decoder_aspect.c:alloc_check
bitwriter.c:alloc_check
Line
Count
Source
70
364
static inline int alloc_check(void) {
71
364
  if(alloc_check_threshold == INT32_MAX)
72
364
    return 0;
73
0
  else if(alloc_check_counter++ == alloc_check_threshold)
74
0
    return 1;
75
0
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
0
  else {
78
0
    return 0;
79
0
  }
80
364
}
Unexecuted instantiation: md5.c:alloc_check
memory.c:alloc_check
Line
Count
Source
70
53.8k
static inline int alloc_check(void) {
71
53.8k
  if(alloc_check_threshold == INT32_MAX)
72
53.8k
    return 0;
73
0
  else if(alloc_check_counter++ == alloc_check_threshold)
74
0
    return 1;
75
0
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
0
  else {
78
0
    return 0;
79
0
  }
80
53.8k
}
81
82
#endif
83
84
/* avoid malloc()ing 0 bytes, see:
85
 * https://www.securecoding.cert.org/confluence/display/seccode/MEM04-A.+Do+not+make+assumptions+about+the+result+of+allocating+0+bytes?focusedCommentId=5407003
86
*/
87
88
static inline void *safe_malloc_(size_t size)
89
274k
{
90
274k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
91
  /* Fail if requested */
92
274k
  if(alloc_check())
93
0
    return NULL;
94
274k
#endif
95
  /* malloc(0) is undefined; FLAC src convention is to always allocate */
96
274k
  if(!size)
97
35
    size++;
98
274k
  return malloc(size);
99
274k
}
operations.c:safe_malloc_
Line
Count
Source
89
5.27k
{
90
5.27k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
91
  /* Fail if requested */
92
5.27k
  if(alloc_check())
93
0
    return NULL;
94
5.27k
#endif
95
  /* malloc(0) is undefined; FLAC src convention is to always allocate */
96
5.27k
  if(!size)
97
0
    size++;
98
5.27k
  return malloc(size);
99
5.27k
}
Unexecuted instantiation: options.c:safe_malloc_
Unexecuted instantiation: utils.c:safe_malloc_
Unexecuted instantiation: utf8.c:safe_malloc_
iconvert.c:safe_malloc_
Line
Count
Source
89
587
{
90
587
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
91
  /* Fail if requested */
92
587
  if(alloc_check())
93
0
    return NULL;
94
587
#endif
95
  /* malloc(0) is undefined; FLAC src convention is to always allocate */
96
587
  if(!size)
97
0
    size++;
98
587
  return malloc(size);
99
587
}
Unexecuted instantiation: alloc.c:safe_malloc_
picture.c:safe_malloc_
Line
Count
Source
89
4.33k
{
90
4.33k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
91
  /* Fail if requested */
92
4.33k
  if(alloc_check())
93
0
    return NULL;
94
4.33k
#endif
95
  /* malloc(0) is undefined; FLAC src convention is to always allocate */
96
4.33k
  if(!size)
97
0
    size++;
98
4.33k
  return malloc(size);
99
4.33k
}
Unexecuted instantiation: replaygain_analysis.c:safe_malloc_
Unexecuted instantiation: format.c:safe_malloc_
metadata_iterators.c:safe_malloc_
Line
Count
Source
89
110k
{
90
110k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
91
  /* Fail if requested */
92
110k
  if(alloc_check())
93
0
    return NULL;
94
110k
#endif
95
  /* malloc(0) is undefined; FLAC src convention is to always allocate */
96
110k
  if(!size)
97
0
    size++;
98
110k
  return malloc(size);
99
110k
}
metadata_object.c:safe_malloc_
Line
Count
Source
89
97.5k
{
90
97.5k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
91
  /* Fail if requested */
92
97.5k
  if(alloc_check())
93
0
    return NULL;
94
97.5k
#endif
95
  /* malloc(0) is undefined; FLAC src convention is to always allocate */
96
97.5k
  if(!size)
97
0
    size++;
98
97.5k
  return malloc(size);
99
97.5k
}
stream_decoder.c:safe_malloc_
Line
Count
Source
89
2.92k
{
90
2.92k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
91
  /* Fail if requested */
92
2.92k
  if(alloc_check())
93
0
    return NULL;
94
2.92k
#endif
95
  /* malloc(0) is undefined; FLAC src convention is to always allocate */
96
2.92k
  if(!size)
97
35
    size++;
98
2.92k
  return malloc(size);
99
2.92k
}
Unexecuted instantiation: ogg_decoder_aspect.c:safe_malloc_
Unexecuted instantiation: bitwriter.c:safe_malloc_
Unexecuted instantiation: md5.c:safe_malloc_
memory.c:safe_malloc_
Line
Count
Source
89
53.8k
{
90
53.8k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
91
  /* Fail if requested */
92
53.8k
  if(alloc_check())
93
0
    return NULL;
94
53.8k
#endif
95
  /* malloc(0) is undefined; FLAC src convention is to always allocate */
96
53.8k
  if(!size)
97
0
    size++;
98
53.8k
  return malloc(size);
99
53.8k
}
100
101
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
102
static inline void *malloc_(size_t size)
103
53.8k
{
104
  /* Fail if requested */
105
53.8k
  if(alloc_check())
106
0
    return NULL;
107
53.8k
  return malloc(size);
108
53.8k
}
Unexecuted instantiation: operations.c:malloc_
Unexecuted instantiation: options.c:malloc_
Unexecuted instantiation: utils.c:malloc_
Unexecuted instantiation: utf8.c:malloc_
Unexecuted instantiation: iconvert.c:malloc_
Unexecuted instantiation: alloc.c:malloc_
Unexecuted instantiation: picture.c:malloc_
Unexecuted instantiation: replaygain_analysis.c:malloc_
Unexecuted instantiation: format.c:malloc_
Unexecuted instantiation: metadata_iterators.c:malloc_
Unexecuted instantiation: metadata_object.c:malloc_
stream_decoder.c:malloc_
Line
Count
Source
103
53.8k
{
104
  /* Fail if requested */
105
53.8k
  if(alloc_check())
106
0
    return NULL;
107
53.8k
  return malloc(size);
108
53.8k
}
Unexecuted instantiation: ogg_decoder_aspect.c:malloc_
Unexecuted instantiation: bitwriter.c:malloc_
Unexecuted instantiation: md5.c:malloc_
Unexecuted instantiation: memory.c:malloc_
109
#else
110
#define malloc_ malloc
111
#endif
112
113
114
115
static inline void *safe_calloc_(size_t nmemb, size_t size)
116
164k
{
117
164k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
118
  /* Fail if requested */
119
164k
  if(alloc_check())
120
0
    return NULL;
121
164k
#endif
122
164k
  if(!nmemb || !size)
123
0
    return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
124
164k
  return calloc(nmemb, size);
125
164k
}
Unexecuted instantiation: operations.c:safe_calloc_
Unexecuted instantiation: options.c:safe_calloc_
Unexecuted instantiation: utils.c:safe_calloc_
Unexecuted instantiation: utf8.c:safe_calloc_
Unexecuted instantiation: iconvert.c:safe_calloc_
Unexecuted instantiation: alloc.c:safe_calloc_
Unexecuted instantiation: picture.c:safe_calloc_
Unexecuted instantiation: replaygain_analysis.c:safe_calloc_
Unexecuted instantiation: format.c:safe_calloc_
Unexecuted instantiation: metadata_iterators.c:safe_calloc_
metadata_object.c:safe_calloc_
Line
Count
Source
116
31.7k
{
117
31.7k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
118
  /* Fail if requested */
119
31.7k
  if(alloc_check())
120
0
    return NULL;
121
31.7k
#endif
122
31.7k
  if(!nmemb || !size)
123
0
    return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
124
31.7k
  return calloc(nmemb, size);
125
31.7k
}
stream_decoder.c:safe_calloc_
Line
Count
Source
116
133k
{
117
133k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
118
  /* Fail if requested */
119
133k
  if(alloc_check())
120
0
    return NULL;
121
133k
#endif
122
133k
  if(!nmemb || !size)
123
0
    return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
124
133k
  return calloc(nmemb, size);
125
133k
}
Unexecuted instantiation: ogg_decoder_aspect.c:safe_calloc_
Unexecuted instantiation: bitwriter.c:safe_calloc_
Unexecuted instantiation: md5.c:safe_calloc_
Unexecuted instantiation: memory.c:safe_calloc_
126
127
/*@@@@ there's probably a better way to prevent overflows when allocating untrusted sums but this works for now */
128
129
static inline void *safe_malloc_add_2op_(size_t size1, size_t size2)
130
207k
{
131
207k
  size2 += size1;
132
207k
  if(size2 < size1)
133
0
    return 0;
134
207k
  return safe_malloc_(size2);
135
207k
}
Unexecuted instantiation: operations.c:safe_malloc_add_2op_
Unexecuted instantiation: options.c:safe_malloc_add_2op_
Unexecuted instantiation: utils.c:safe_malloc_add_2op_
Unexecuted instantiation: utf8.c:safe_malloc_add_2op_
iconvert.c:safe_malloc_add_2op_
Line
Count
Source
130
587
{
131
587
  size2 += size1;
132
587
  if(size2 < size1)
133
0
    return 0;
134
587
  return safe_malloc_(size2);
135
587
}
Unexecuted instantiation: alloc.c:safe_malloc_add_2op_
picture.c:safe_malloc_add_2op_
Line
Count
Source
130
3.49k
{
131
3.49k
  size2 += size1;
132
3.49k
  if(size2 < size1)
133
0
    return 0;
134
3.49k
  return safe_malloc_(size2);
135
3.49k
}
Unexecuted instantiation: replaygain_analysis.c:safe_malloc_add_2op_
Unexecuted instantiation: format.c:safe_malloc_add_2op_
metadata_iterators.c:safe_malloc_add_2op_
Line
Count
Source
130
107k
{
131
107k
  size2 += size1;
132
107k
  if(size2 < size1)
133
0
    return 0;
134
107k
  return safe_malloc_(size2);
135
107k
}
metadata_object.c:safe_malloc_add_2op_
Line
Count
Source
130
38.9k
{
131
38.9k
  size2 += size1;
132
38.9k
  if(size2 < size1)
133
0
    return 0;
134
38.9k
  return safe_malloc_(size2);
135
38.9k
}
stream_decoder.c:safe_malloc_add_2op_
Line
Count
Source
130
2.72k
{
131
2.72k
  size2 += size1;
132
2.72k
  if(size2 < size1)
133
0
    return 0;
134
2.72k
  return safe_malloc_(size2);
135
2.72k
}
Unexecuted instantiation: ogg_decoder_aspect.c:safe_malloc_add_2op_
Unexecuted instantiation: bitwriter.c:safe_malloc_add_2op_
Unexecuted instantiation: md5.c:safe_malloc_add_2op_
memory.c:safe_malloc_add_2op_
Line
Count
Source
130
53.8k
{
131
53.8k
  size2 += size1;
132
53.8k
  if(size2 < size1)
133
0
    return 0;
134
53.8k
  return safe_malloc_(size2);
135
53.8k
}
136
137
static inline void *safe_malloc_add_3op_(size_t size1, size_t size2, size_t size3)
138
0
{
139
0
  size2 += size1;
140
0
  if(size2 < size1)
141
0
    return 0;
142
0
  size3 += size2;
143
0
  if(size3 < size2)
144
0
    return 0;
145
0
  return safe_malloc_(size3);
146
0
}
Unexecuted instantiation: operations.c:safe_malloc_add_3op_
Unexecuted instantiation: options.c:safe_malloc_add_3op_
Unexecuted instantiation: utils.c:safe_malloc_add_3op_
Unexecuted instantiation: utf8.c:safe_malloc_add_3op_
Unexecuted instantiation: iconvert.c:safe_malloc_add_3op_
Unexecuted instantiation: alloc.c:safe_malloc_add_3op_
Unexecuted instantiation: picture.c:safe_malloc_add_3op_
Unexecuted instantiation: replaygain_analysis.c:safe_malloc_add_3op_
Unexecuted instantiation: format.c:safe_malloc_add_3op_
Unexecuted instantiation: metadata_iterators.c:safe_malloc_add_3op_
Unexecuted instantiation: metadata_object.c:safe_malloc_add_3op_
Unexecuted instantiation: stream_decoder.c:safe_malloc_add_3op_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_malloc_add_3op_
Unexecuted instantiation: bitwriter.c:safe_malloc_add_3op_
Unexecuted instantiation: md5.c:safe_malloc_add_3op_
Unexecuted instantiation: memory.c:safe_malloc_add_3op_
147
148
static inline void *safe_malloc_add_4op_(size_t size1, size_t size2, size_t size3, size_t size4)
149
290
{
150
290
  size2 += size1;
151
290
  if(size2 < size1)
152
0
    return 0;
153
290
  size3 += size2;
154
290
  if(size3 < size2)
155
0
    return 0;
156
290
  size4 += size3;
157
290
  if(size4 < size3)
158
0
    return 0;
159
290
  return safe_malloc_(size4);
160
290
}
Unexecuted instantiation: operations.c:safe_malloc_add_4op_
Unexecuted instantiation: options.c:safe_malloc_add_4op_
Unexecuted instantiation: utils.c:safe_malloc_add_4op_
Unexecuted instantiation: utf8.c:safe_malloc_add_4op_
Unexecuted instantiation: iconvert.c:safe_malloc_add_4op_
Unexecuted instantiation: alloc.c:safe_malloc_add_4op_
Unexecuted instantiation: picture.c:safe_malloc_add_4op_
Unexecuted instantiation: replaygain_analysis.c:safe_malloc_add_4op_
Unexecuted instantiation: format.c:safe_malloc_add_4op_
Unexecuted instantiation: metadata_iterators.c:safe_malloc_add_4op_
metadata_object.c:safe_malloc_add_4op_
Line
Count
Source
149
290
{
150
290
  size2 += size1;
151
290
  if(size2 < size1)
152
0
    return 0;
153
290
  size3 += size2;
154
290
  if(size3 < size2)
155
0
    return 0;
156
290
  size4 += size3;
157
290
  if(size4 < size3)
158
0
    return 0;
159
290
  return safe_malloc_(size4);
160
290
}
Unexecuted instantiation: stream_decoder.c:safe_malloc_add_4op_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_malloc_add_4op_
Unexecuted instantiation: bitwriter.c:safe_malloc_add_4op_
Unexecuted instantiation: md5.c:safe_malloc_add_4op_
Unexecuted instantiation: memory.c:safe_malloc_add_4op_
161
162
void *safe_malloc_mul_2op_(size_t size1, size_t size2) ;
163
164
static inline void *safe_malloc_mul_3op_(size_t size1, size_t size2, size_t size3)
165
0
{
166
0
  if(!size1 || !size2 || !size3)
167
0
    return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
168
0
  if(size1 > SIZE_MAX / size2)
169
0
    return 0;
170
0
  size1 *= size2;
171
0
  if(size1 > SIZE_MAX / size3)
172
0
    return 0;
173
0
  return malloc_(size1*size3);
174
0
}
Unexecuted instantiation: operations.c:safe_malloc_mul_3op_
Unexecuted instantiation: options.c:safe_malloc_mul_3op_
Unexecuted instantiation: utils.c:safe_malloc_mul_3op_
Unexecuted instantiation: utf8.c:safe_malloc_mul_3op_
Unexecuted instantiation: iconvert.c:safe_malloc_mul_3op_
Unexecuted instantiation: alloc.c:safe_malloc_mul_3op_
Unexecuted instantiation: picture.c:safe_malloc_mul_3op_
Unexecuted instantiation: replaygain_analysis.c:safe_malloc_mul_3op_
Unexecuted instantiation: format.c:safe_malloc_mul_3op_
Unexecuted instantiation: metadata_iterators.c:safe_malloc_mul_3op_
Unexecuted instantiation: metadata_object.c:safe_malloc_mul_3op_
Unexecuted instantiation: stream_decoder.c:safe_malloc_mul_3op_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_malloc_mul_3op_
Unexecuted instantiation: bitwriter.c:safe_malloc_mul_3op_
Unexecuted instantiation: md5.c:safe_malloc_mul_3op_
Unexecuted instantiation: memory.c:safe_malloc_mul_3op_
175
176
/* size1*size2 + size3 */
177
static inline void *safe_malloc_mul2add_(size_t size1, size_t size2, size_t size3)
178
0
{
179
0
  if(!size1 || !size2)
180
0
    return safe_malloc_(size3);
181
0
  if(size1 > SIZE_MAX / size2)
182
0
    return 0;
183
0
  return safe_malloc_add_2op_(size1*size2, size3);
184
0
}
Unexecuted instantiation: operations.c:safe_malloc_mul2add_
Unexecuted instantiation: options.c:safe_malloc_mul2add_
Unexecuted instantiation: utils.c:safe_malloc_mul2add_
Unexecuted instantiation: utf8.c:safe_malloc_mul2add_
Unexecuted instantiation: iconvert.c:safe_malloc_mul2add_
Unexecuted instantiation: alloc.c:safe_malloc_mul2add_
Unexecuted instantiation: picture.c:safe_malloc_mul2add_
Unexecuted instantiation: replaygain_analysis.c:safe_malloc_mul2add_
Unexecuted instantiation: format.c:safe_malloc_mul2add_
Unexecuted instantiation: metadata_iterators.c:safe_malloc_mul2add_
Unexecuted instantiation: metadata_object.c:safe_malloc_mul2add_
Unexecuted instantiation: stream_decoder.c:safe_malloc_mul2add_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_malloc_mul2add_
Unexecuted instantiation: bitwriter.c:safe_malloc_mul2add_
Unexecuted instantiation: md5.c:safe_malloc_mul2add_
Unexecuted instantiation: memory.c:safe_malloc_mul2add_
185
186
/* size1 * (size2 + size3) */
187
static inline void *safe_malloc_muladd2_(size_t size1, size_t size2, size_t size3)
188
53.8k
{
189
53.8k
  if(!size1 || (!size2 && !size3))
190
0
    return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
191
53.8k
  size2 += size3;
192
53.8k
  if(size2 < size3)
193
0
    return 0;
194
53.8k
  if(size1 > SIZE_MAX / size2)
195
0
    return 0;
196
53.8k
  return malloc_(size1*size2);
197
53.8k
}
Unexecuted instantiation: operations.c:safe_malloc_muladd2_
Unexecuted instantiation: options.c:safe_malloc_muladd2_
Unexecuted instantiation: utils.c:safe_malloc_muladd2_
Unexecuted instantiation: utf8.c:safe_malloc_muladd2_
Unexecuted instantiation: iconvert.c:safe_malloc_muladd2_
Unexecuted instantiation: alloc.c:safe_malloc_muladd2_
Unexecuted instantiation: picture.c:safe_malloc_muladd2_
Unexecuted instantiation: replaygain_analysis.c:safe_malloc_muladd2_
Unexecuted instantiation: format.c:safe_malloc_muladd2_
Unexecuted instantiation: metadata_iterators.c:safe_malloc_muladd2_
Unexecuted instantiation: metadata_object.c:safe_malloc_muladd2_
stream_decoder.c:safe_malloc_muladd2_
Line
Count
Source
188
53.8k
{
189
53.8k
  if(!size1 || (!size2 && !size3))
190
0
    return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
191
53.8k
  size2 += size3;
192
53.8k
  if(size2 < size3)
193
0
    return 0;
194
53.8k
  if(size1 > SIZE_MAX / size2)
195
0
    return 0;
196
53.8k
  return malloc_(size1*size2);
197
53.8k
}
Unexecuted instantiation: ogg_decoder_aspect.c:safe_malloc_muladd2_
Unexecuted instantiation: bitwriter.c:safe_malloc_muladd2_
Unexecuted instantiation: md5.c:safe_malloc_muladd2_
Unexecuted instantiation: memory.c:safe_malloc_muladd2_
198
199
static inline void *safe_realloc_(void *ptr, size_t size)
200
94.2k
{
201
94.2k
  void *oldptr;
202
94.2k
  void *newptr;
203
94.2k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
204
  /* Fail if requested */
205
94.2k
  if(alloc_check() && size > 0) {
206
0
    free(ptr);
207
0
    return NULL;
208
0
  }
209
94.2k
#endif
210
94.2k
  oldptr = ptr;
211
94.2k
  newptr = realloc(ptr, size);
212
94.2k
  if(size > 0 && newptr == 0)
213
0
    free(oldptr);
214
94.2k
  return newptr;
215
94.2k
}
Unexecuted instantiation: operations.c:safe_realloc_
options.c:safe_realloc_
Line
Count
Source
200
6
{
201
6
  void *oldptr;
202
6
  void *newptr;
203
6
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
204
  /* Fail if requested */
205
6
  if(alloc_check() && size > 0) {
206
0
    free(ptr);
207
0
    return NULL;
208
0
  }
209
6
#endif
210
6
  oldptr = ptr;
211
6
  newptr = realloc(ptr, size);
212
6
  if(size > 0 && newptr == 0)
213
0
    free(oldptr);
214
6
  return newptr;
215
6
}
utils.c:safe_realloc_
Line
Count
Source
200
29.3k
{
201
29.3k
  void *oldptr;
202
29.3k
  void *newptr;
203
29.3k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
204
  /* Fail if requested */
205
29.3k
  if(alloc_check() && size > 0) {
206
0
    free(ptr);
207
0
    return NULL;
208
0
  }
209
29.3k
#endif
210
29.3k
  oldptr = ptr;
211
29.3k
  newptr = realloc(ptr, size);
212
29.3k
  if(size > 0 && newptr == 0)
213
0
    free(oldptr);
214
29.3k
  return newptr;
215
29.3k
}
Unexecuted instantiation: utf8.c:safe_realloc_
Unexecuted instantiation: iconvert.c:safe_realloc_
Unexecuted instantiation: alloc.c:safe_realloc_
Unexecuted instantiation: picture.c:safe_realloc_
replaygain_analysis.c:safe_realloc_
Line
Count
Source
200
44.8k
{
201
44.8k
  void *oldptr;
202
44.8k
  void *newptr;
203
44.8k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
204
  /* Fail if requested */
205
44.8k
  if(alloc_check() && size > 0) {
206
0
    free(ptr);
207
0
    return NULL;
208
0
  }
209
44.8k
#endif
210
44.8k
  oldptr = ptr;
211
44.8k
  newptr = realloc(ptr, size);
212
44.8k
  if(size > 0 && newptr == 0)
213
0
    free(oldptr);
214
44.8k
  return newptr;
215
44.8k
}
format.c:safe_realloc_
Line
Count
Source
200
19.3k
{
201
19.3k
  void *oldptr;
202
19.3k
  void *newptr;
203
19.3k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
204
  /* Fail if requested */
205
19.3k
  if(alloc_check() && size > 0) {
206
0
    free(ptr);
207
0
    return NULL;
208
0
  }
209
19.3k
#endif
210
19.3k
  oldptr = ptr;
211
19.3k
  newptr = realloc(ptr, size);
212
19.3k
  if(size > 0 && newptr == 0)
213
0
    free(oldptr);
214
19.3k
  return newptr;
215
19.3k
}
Unexecuted instantiation: metadata_iterators.c:safe_realloc_
Unexecuted instantiation: metadata_object.c:safe_realloc_
stream_decoder.c:safe_realloc_
Line
Count
Source
200
659
{
201
659
  void *oldptr;
202
659
  void *newptr;
203
659
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
204
  /* Fail if requested */
205
659
  if(alloc_check() && size > 0) {
206
0
    free(ptr);
207
0
    return NULL;
208
0
  }
209
659
#endif
210
659
  oldptr = ptr;
211
659
  newptr = realloc(ptr, size);
212
659
  if(size > 0 && newptr == 0)
213
0
    free(oldptr);
214
659
  return newptr;
215
659
}
Unexecuted instantiation: ogg_decoder_aspect.c:safe_realloc_
Unexecuted instantiation: bitwriter.c:safe_realloc_
Unexecuted instantiation: md5.c:safe_realloc_
Unexecuted instantiation: memory.c:safe_realloc_
216
217
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
218
static inline void *realloc_(void *ptr, size_t size)
219
38.3k
{
220
  /* Fail if requested */
221
38.3k
  if(alloc_check())
222
0
    return NULL;
223
38.3k
  return realloc(ptr, size);
224
38.3k
}
Unexecuted instantiation: operations.c:realloc_
Unexecuted instantiation: options.c:realloc_
Unexecuted instantiation: utils.c:realloc_
Unexecuted instantiation: utf8.c:realloc_
iconvert.c:realloc_
Line
Count
Source
219
37.6k
{
220
  /* Fail if requested */
221
37.6k
  if(alloc_check())
222
0
    return NULL;
223
37.6k
  return realloc(ptr, size);
224
37.6k
}
Unexecuted instantiation: alloc.c:realloc_
Unexecuted instantiation: picture.c:realloc_
Unexecuted instantiation: replaygain_analysis.c:realloc_
Unexecuted instantiation: format.c:realloc_
Unexecuted instantiation: metadata_iterators.c:realloc_
metadata_object.c:realloc_
Line
Count
Source
219
290
{
220
  /* Fail if requested */
221
290
  if(alloc_check())
222
0
    return NULL;
223
290
  return realloc(ptr, size);
224
290
}
Unexecuted instantiation: stream_decoder.c:realloc_
Unexecuted instantiation: ogg_decoder_aspect.c:realloc_
bitwriter.c:realloc_
Line
Count
Source
219
364
{
220
  /* Fail if requested */
221
364
  if(alloc_check())
222
0
    return NULL;
223
364
  return realloc(ptr, size);
224
364
}
Unexecuted instantiation: md5.c:realloc_
Unexecuted instantiation: memory.c:realloc_
225
#else
226
#define realloc_ realloc
227
#endif
228
229
230
static inline void *safe_realloc_nofree_add_2op_(void *ptr, size_t size1, size_t size2)
231
37.9k
{
232
37.9k
  size2 += size1;
233
37.9k
  if(size2 < size1)
234
0
    return 0;
235
37.9k
  return realloc_(ptr, size2);
236
37.9k
}
Unexecuted instantiation: operations.c:safe_realloc_nofree_add_2op_
Unexecuted instantiation: options.c:safe_realloc_nofree_add_2op_
Unexecuted instantiation: utils.c:safe_realloc_nofree_add_2op_
Unexecuted instantiation: utf8.c:safe_realloc_nofree_add_2op_
iconvert.c:safe_realloc_nofree_add_2op_
Line
Count
Source
231
37.6k
{
232
37.6k
  size2 += size1;
233
37.6k
  if(size2 < size1)
234
0
    return 0;
235
37.6k
  return realloc_(ptr, size2);
236
37.6k
}
Unexecuted instantiation: alloc.c:safe_realloc_nofree_add_2op_
Unexecuted instantiation: picture.c:safe_realloc_nofree_add_2op_
Unexecuted instantiation: replaygain_analysis.c:safe_realloc_nofree_add_2op_
Unexecuted instantiation: format.c:safe_realloc_nofree_add_2op_
Unexecuted instantiation: metadata_iterators.c:safe_realloc_nofree_add_2op_
metadata_object.c:safe_realloc_nofree_add_2op_
Line
Count
Source
231
290
{
232
290
  size2 += size1;
233
290
  if(size2 < size1)
234
0
    return 0;
235
290
  return realloc_(ptr, size2);
236
290
}
Unexecuted instantiation: stream_decoder.c:safe_realloc_nofree_add_2op_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_realloc_nofree_add_2op_
Unexecuted instantiation: bitwriter.c:safe_realloc_nofree_add_2op_
Unexecuted instantiation: md5.c:safe_realloc_nofree_add_2op_
Unexecuted instantiation: memory.c:safe_realloc_nofree_add_2op_
237
238
static inline void *safe_realloc_add_3op_(void *ptr, size_t size1, size_t size2, size_t size3)
239
29.3k
{
240
29.3k
  size2 += size1;
241
29.3k
  if(size2 < size1) {
242
0
    free(ptr);
243
0
    return 0;
244
0
  }
245
29.3k
  size3 += size2;
246
29.3k
  if(size3 < size2) {
247
0
    free(ptr);
248
0
    return 0;
249
0
  }
250
29.3k
  return safe_realloc_(ptr, size3);
251
29.3k
}
Unexecuted instantiation: operations.c:safe_realloc_add_3op_
Unexecuted instantiation: options.c:safe_realloc_add_3op_
utils.c:safe_realloc_add_3op_
Line
Count
Source
239
29.3k
{
240
29.3k
  size2 += size1;
241
29.3k
  if(size2 < size1) {
242
0
    free(ptr);
243
0
    return 0;
244
0
  }
245
29.3k
  size3 += size2;
246
29.3k
  if(size3 < size2) {
247
0
    free(ptr);
248
0
    return 0;
249
0
  }
250
29.3k
  return safe_realloc_(ptr, size3);
251
29.3k
}
Unexecuted instantiation: utf8.c:safe_realloc_add_3op_
Unexecuted instantiation: iconvert.c:safe_realloc_add_3op_
Unexecuted instantiation: alloc.c:safe_realloc_add_3op_
Unexecuted instantiation: picture.c:safe_realloc_add_3op_
Unexecuted instantiation: replaygain_analysis.c:safe_realloc_add_3op_
Unexecuted instantiation: format.c:safe_realloc_add_3op_
Unexecuted instantiation: metadata_iterators.c:safe_realloc_add_3op_
Unexecuted instantiation: metadata_object.c:safe_realloc_add_3op_
Unexecuted instantiation: stream_decoder.c:safe_realloc_add_3op_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_realloc_add_3op_
Unexecuted instantiation: bitwriter.c:safe_realloc_add_3op_
Unexecuted instantiation: md5.c:safe_realloc_add_3op_
Unexecuted instantiation: memory.c:safe_realloc_add_3op_
252
253
static inline void *safe_realloc_nofree_add_3op_(void *ptr, size_t size1, size_t size2, size_t size3)
254
0
{
255
0
  size2 += size1;
256
0
  if(size2 < size1)
257
0
    return 0;
258
0
  size3 += size2;
259
0
  if(size3 < size2)
260
0
    return 0;
261
0
  return realloc_(ptr, size3);
262
0
}
Unexecuted instantiation: operations.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: options.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: utils.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: utf8.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: iconvert.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: alloc.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: picture.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: replaygain_analysis.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: format.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: metadata_iterators.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: metadata_object.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: stream_decoder.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: bitwriter.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: md5.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: memory.c:safe_realloc_nofree_add_3op_
263
264
static inline void *safe_realloc_nofree_add_4op_(void *ptr, size_t size1, size_t size2, size_t size3, size_t size4)
265
0
{
266
0
  size2 += size1;
267
0
  if(size2 < size1)
268
0
    return 0;
269
0
  size3 += size2;
270
0
  if(size3 < size2)
271
0
    return 0;
272
0
  size4 += size3;
273
0
  if(size4 < size3)
274
0
    return 0;
275
0
  return realloc_(ptr, size4);
276
0
}
Unexecuted instantiation: operations.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: options.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: utils.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: utf8.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: iconvert.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: alloc.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: picture.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: replaygain_analysis.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: format.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: metadata_iterators.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: metadata_object.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: stream_decoder.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: bitwriter.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: md5.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: memory.c:safe_realloc_nofree_add_4op_
277
278
static inline void *safe_realloc_mul_2op_(void *ptr, size_t size1, size_t size2)
279
665
{
280
665
  if(!size1 || !size2)
281
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
282
665
  if(size1 > SIZE_MAX / size2) {
283
0
    free(ptr);
284
0
    return 0;
285
0
  }
286
665
  return safe_realloc_(ptr, size1*size2);
287
665
}
Unexecuted instantiation: operations.c:safe_realloc_mul_2op_
options.c:safe_realloc_mul_2op_
Line
Count
Source
279
6
{
280
6
  if(!size1 || !size2)
281
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
282
6
  if(size1 > SIZE_MAX / size2) {
283
0
    free(ptr);
284
0
    return 0;
285
0
  }
286
6
  return safe_realloc_(ptr, size1*size2);
287
6
}
Unexecuted instantiation: utils.c:safe_realloc_mul_2op_
Unexecuted instantiation: utf8.c:safe_realloc_mul_2op_
Unexecuted instantiation: iconvert.c:safe_realloc_mul_2op_
Unexecuted instantiation: alloc.c:safe_realloc_mul_2op_
Unexecuted instantiation: picture.c:safe_realloc_mul_2op_
Unexecuted instantiation: replaygain_analysis.c:safe_realloc_mul_2op_
Unexecuted instantiation: format.c:safe_realloc_mul_2op_
Unexecuted instantiation: metadata_iterators.c:safe_realloc_mul_2op_
Unexecuted instantiation: metadata_object.c:safe_realloc_mul_2op_
stream_decoder.c:safe_realloc_mul_2op_
Line
Count
Source
279
659
{
280
659
  if(!size1 || !size2)
281
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
282
659
  if(size1 > SIZE_MAX / size2) {
283
0
    free(ptr);
284
0
    return 0;
285
0
  }
286
659
  return safe_realloc_(ptr, size1*size2);
287
659
}
Unexecuted instantiation: ogg_decoder_aspect.c:safe_realloc_mul_2op_
Unexecuted instantiation: bitwriter.c:safe_realloc_mul_2op_
Unexecuted instantiation: md5.c:safe_realloc_mul_2op_
Unexecuted instantiation: memory.c:safe_realloc_mul_2op_
288
289
static inline void *safe_realloc_nofree_mul_2op_(void *ptr, size_t size1, size_t size2)
290
364
{
291
364
  if(!size1 || !size2)
292
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
293
364
  if(size1 > SIZE_MAX / size2)
294
0
    return 0;
295
364
  return realloc_(ptr, size1*size2);
296
364
}
Unexecuted instantiation: operations.c:safe_realloc_nofree_mul_2op_
Unexecuted instantiation: options.c:safe_realloc_nofree_mul_2op_
Unexecuted instantiation: utils.c:safe_realloc_nofree_mul_2op_
Unexecuted instantiation: utf8.c:safe_realloc_nofree_mul_2op_
Unexecuted instantiation: iconvert.c:safe_realloc_nofree_mul_2op_
Unexecuted instantiation: alloc.c:safe_realloc_nofree_mul_2op_
Unexecuted instantiation: picture.c:safe_realloc_nofree_mul_2op_
Unexecuted instantiation: replaygain_analysis.c:safe_realloc_nofree_mul_2op_
Unexecuted instantiation: format.c:safe_realloc_nofree_mul_2op_
Unexecuted instantiation: metadata_iterators.c:safe_realloc_nofree_mul_2op_
Unexecuted instantiation: metadata_object.c:safe_realloc_nofree_mul_2op_
Unexecuted instantiation: stream_decoder.c:safe_realloc_nofree_mul_2op_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_realloc_nofree_mul_2op_
bitwriter.c:safe_realloc_nofree_mul_2op_
Line
Count
Source
290
364
{
291
364
  if(!size1 || !size2)
292
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
293
364
  if(size1 > SIZE_MAX / size2)
294
0
    return 0;
295
364
  return realloc_(ptr, size1*size2);
296
364
}
Unexecuted instantiation: md5.c:safe_realloc_nofree_mul_2op_
Unexecuted instantiation: memory.c:safe_realloc_nofree_mul_2op_
297
298
/* size1 * (size2 + size3) */
299
static inline void *safe_realloc_muladd2_(void *ptr, size_t size1, size_t size2, size_t size3)
300
0
{
301
0
  if(!size1 || (!size2 && !size3))
302
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
303
0
  size2 += size3;
304
0
  if(size2 < size3) {
305
0
    free(ptr);
306
0
    return 0;
307
0
  }
308
0
  return safe_realloc_mul_2op_(ptr, size1, size2);
309
0
}
Unexecuted instantiation: operations.c:safe_realloc_muladd2_
Unexecuted instantiation: options.c:safe_realloc_muladd2_
Unexecuted instantiation: utils.c:safe_realloc_muladd2_
Unexecuted instantiation: utf8.c:safe_realloc_muladd2_
Unexecuted instantiation: iconvert.c:safe_realloc_muladd2_
Unexecuted instantiation: alloc.c:safe_realloc_muladd2_
Unexecuted instantiation: picture.c:safe_realloc_muladd2_
Unexecuted instantiation: replaygain_analysis.c:safe_realloc_muladd2_
Unexecuted instantiation: format.c:safe_realloc_muladd2_
Unexecuted instantiation: metadata_iterators.c:safe_realloc_muladd2_
Unexecuted instantiation: metadata_object.c:safe_realloc_muladd2_
Unexecuted instantiation: stream_decoder.c:safe_realloc_muladd2_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_realloc_muladd2_
Unexecuted instantiation: bitwriter.c:safe_realloc_muladd2_
Unexecuted instantiation: md5.c:safe_realloc_muladd2_
Unexecuted instantiation: memory.c:safe_realloc_muladd2_
310
311
/* size1 * (size2 + size3) */
312
static inline void *safe_realloc_nofree_muladd2_(void *ptr, size_t size1, size_t size2, size_t size3)
313
0
{
314
0
  if(!size1 || (!size2 && !size3))
315
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
316
0
  size2 += size3;
317
0
  if(size2 < size3)
318
0
    return 0;
319
0
  return safe_realloc_nofree_mul_2op_(ptr, size1, size2);
320
0
}
Unexecuted instantiation: operations.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: options.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: utils.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: utf8.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: iconvert.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: alloc.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: picture.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: replaygain_analysis.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: format.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: metadata_iterators.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: metadata_object.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: stream_decoder.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: bitwriter.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: md5.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: memory.c:safe_realloc_nofree_muladd2_
321
322
#endif