Coverage Report

Created: 2026-11-12 07:05

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
3.44M
static inline int alloc_check(void) {
71
3.44M
  if(alloc_check_threshold == INT32_MAX)
72
1.58M
    return 0;
73
1.86M
  else if(alloc_check_counter++ == alloc_check_threshold)
74
994
    return 1;
75
1.86M
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
1.39k
    return 1;
77
1.85M
  else {
78
1.85M
    return 0;
79
1.85M
  }
80
3.44M
}
encode.c:alloc_check
Line
Count
Source
70
179k
static inline int alloc_check(void) {
71
179k
  if(alloc_check_threshold == INT32_MAX)
72
161k
    return 0;
73
17.7k
  else if(alloc_check_counter++ == alloc_check_threshold)
74
35
    return 1;
75
17.7k
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
1
    return 1;
77
17.7k
  else {
78
17.7k
    return 0;
79
17.7k
  }
80
179k
}
foreign_metadata.c:alloc_check
Line
Count
Source
70
185k
static inline int alloc_check(void) {
71
185k
  if(alloc_check_threshold == INT32_MAX)
72
184k
    return 0;
73
972
  else if(alloc_check_counter++ == alloc_check_threshold)
74
11
    return 1;
75
961
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
1
    return 1;
77
960
  else {
78
960
    return 0;
79
960
  }
80
185k
}
Unexecuted instantiation: tool_flac.c:alloc_check
Unexecuted instantiation: utf8.c:alloc_check
iconvert.c:alloc_check
Line
Count
Source
70
2.97k
static inline int alloc_check(void) {
71
2.97k
  if(alloc_check_threshold == INT32_MAX)
72
2.02k
    return 0;
73
953
  else if(alloc_check_counter++ == alloc_check_threshold)
74
23
    return 1;
75
930
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
140
    return 1;
77
790
  else {
78
790
    return 0;
79
790
  }
80
2.97k
}
picture.c:alloc_check
Line
Count
Source
70
5.83k
static inline int alloc_check(void) {
71
5.83k
  if(alloc_check_threshold == INT32_MAX)
72
3.63k
    return 0;
73
2.20k
  else if(alloc_check_counter++ == alloc_check_threshold)
74
33
    return 1;
75
2.17k
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
330
    return 1;
77
1.84k
  else {
78
1.84k
    return 0;
79
1.84k
  }
80
5.83k
}
replaygain_analysis.c:alloc_check
Line
Count
Source
70
5.15k
static inline int alloc_check(void) {
71
5.15k
  if(alloc_check_threshold == INT32_MAX)
72
3.74k
    return 0;
73
1.41k
  else if(alloc_check_counter++ == alloc_check_threshold)
74
4
    return 1;
75
1.40k
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
1.40k
  else {
78
1.40k
    return 0;
79
1.40k
  }
80
5.15k
}
format.c:alloc_check
Line
Count
Source
70
1.47M
static inline int alloc_check(void) {
71
1.47M
  if(alloc_check_threshold == INT32_MAX)
72
481k
    return 0;
73
991k
  else if(alloc_check_counter++ == alloc_check_threshold)
74
128
    return 1;
75
991k
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
991k
  else {
78
991k
    return 0;
79
991k
  }
80
1.47M
}
Unexecuted instantiation: metadata_iterators.c:alloc_check
metadata_object.c:alloc_check
Line
Count
Source
70
67.2k
static inline int alloc_check(void) {
71
67.2k
  if(alloc_check_threshold == INT32_MAX)
72
60.1k
    return 0;
73
7.13k
  else if(alloc_check_counter++ == alloc_check_threshold)
74
111
    return 1;
75
7.02k
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
267
    return 1;
77
6.75k
  else {
78
6.75k
    return 0;
79
6.75k
  }
80
67.2k
}
stream_decoder.c:alloc_check
Line
Count
Source
70
198k
static inline int alloc_check(void) {
71
198k
  if(alloc_check_threshold == INT32_MAX)
72
155k
    return 0;
73
43.0k
  else if(alloc_check_counter++ == alloc_check_threshold)
74
367
    return 1;
75
42.6k
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
539
    return 1;
77
42.1k
  else {
78
42.1k
    return 0;
79
42.1k
  }
80
198k
}
stream_encoder.c:alloc_check
Line
Count
Source
70
133k
static inline int alloc_check(void) {
71
133k
  if(alloc_check_threshold == INT32_MAX)
72
90.4k
    return 0;
73
43.4k
  else if(alloc_check_counter++ == alloc_check_threshold)
74
66
    return 1;
75
43.3k
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
110
    return 1;
77
43.2k
  else {
78
43.2k
    return 0;
79
43.2k
  }
80
133k
}
ogg_decoder_aspect.c:alloc_check
Line
Count
Source
70
6.43k
static inline int alloc_check(void) {
71
6.43k
  if(alloc_check_threshold == INT32_MAX)
72
3.02k
    return 0;
73
3.41k
  else if(alloc_check_counter++ == alloc_check_threshold)
74
14
    return 1;
75
3.39k
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
1
    return 1;
77
3.39k
  else {
78
3.39k
    return 0;
79
3.39k
  }
80
6.43k
}
ogg_helper.c:alloc_check
Line
Count
Source
70
996
static inline int alloc_check(void) {
71
996
  if(alloc_check_threshold == INT32_MAX)
72
710
    return 0;
73
286
  else if(alloc_check_counter++ == alloc_check_threshold)
74
5
    return 1;
75
281
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
281
  else {
78
281
    return 0;
79
281
  }
80
996
}
bitwriter.c:alloc_check
Line
Count
Source
70
23.4k
static inline int alloc_check(void) {
71
23.4k
  if(alloc_check_threshold == INT32_MAX)
72
22.5k
    return 0;
73
938
  else if(alloc_check_counter++ == alloc_check_threshold)
74
17
    return 1;
75
921
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
921
  else {
78
921
    return 0;
79
921
  }
80
23.4k
}
md5.c:alloc_check
Line
Count
Source
70
5.30k
static inline int alloc_check(void) {
71
5.30k
  if(alloc_check_threshold == INT32_MAX)
72
4.72k
    return 0;
73
584
  else if(alloc_check_counter++ == alloc_check_threshold)
74
11
    return 1;
75
573
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
2
    return 1;
77
571
  else {
78
571
    return 0;
79
571
  }
80
5.30k
}
memory.c:alloc_check
Line
Count
Source
70
1.15M
static inline int alloc_check(void) {
71
1.15M
  if(alloc_check_threshold == INT32_MAX)
72
406k
    return 0;
73
747k
  else if(alloc_check_counter++ == alloc_check_threshold)
74
169
    return 1;
75
747k
  else if(alloc_check_keep_failing && (alloc_check_counter > alloc_check_threshold))
76
0
    return 1;
77
747k
  else {
78
747k
    return 0;
79
747k
  }
80
1.15M
}
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
1.23M
{
90
1.23M
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
91
  /* Fail if requested */
92
1.23M
  if(alloc_check())
93
838
    return NULL;
94
1.23M
#endif
95
  /* malloc(0) is undefined; FLAC src convention is to always allocate */
96
1.23M
  if(!size)
97
95
    size++;
98
1.23M
  return malloc(size);
99
1.23M
}
Unexecuted instantiation: encode.c:safe_malloc_
Unexecuted instantiation: foreign_metadata.c:safe_malloc_
Unexecuted instantiation: tool_flac.c:safe_malloc_
Unexecuted instantiation: utf8.c:safe_malloc_
Unexecuted instantiation: iconvert.c:safe_malloc_
picture.c:safe_malloc_
Line
Count
Source
89
5.83k
{
90
5.83k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
91
  /* Fail if requested */
92
5.83k
  if(alloc_check())
93
363
    return NULL;
94
5.47k
#endif
95
  /* malloc(0) is undefined; FLAC src convention is to always allocate */
96
5.47k
  if(!size)
97
0
    size++;
98
5.47k
  return malloc(size);
99
5.83k
}
Unexecuted instantiation: replaygain_analysis.c:safe_malloc_
Unexecuted instantiation: format.c:safe_malloc_
Unexecuted instantiation: metadata_iterators.c:safe_malloc_
metadata_object.c:safe_malloc_
Line
Count
Source
89
52.1k
{
90
52.1k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
91
  /* Fail if requested */
92
52.1k
  if(alloc_check())
93
291
    return NULL;
94
51.8k
#endif
95
  /* malloc(0) is undefined; FLAC src convention is to always allocate */
96
51.8k
  if(!size)
97
0
    size++;
98
51.8k
  return malloc(size);
99
52.1k
}
stream_decoder.c:safe_malloc_
Line
Count
Source
89
26.5k
{
90
26.5k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
91
  /* Fail if requested */
92
26.5k
  if(alloc_check())
93
8
    return NULL;
94
26.5k
#endif
95
  /* malloc(0) is undefined; FLAC src convention is to always allocate */
96
26.5k
  if(!size)
97
95
    size++;
98
26.5k
  return malloc(size);
99
26.5k
}
Unexecuted instantiation: stream_encoder.c:safe_malloc_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_malloc_
ogg_helper.c:safe_malloc_
Line
Count
Source
89
996
{
90
996
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
91
  /* Fail if requested */
92
996
  if(alloc_check())
93
5
    return NULL;
94
991
#endif
95
  /* malloc(0) is undefined; FLAC src convention is to always allocate */
96
991
  if(!size)
97
0
    size++;
98
991
  return malloc(size);
99
996
}
Unexecuted instantiation: bitwriter.c:safe_malloc_
md5.c:safe_malloc_
Line
Count
Source
89
11
{
90
11
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
91
  /* Fail if requested */
92
11
  if(alloc_check())
93
2
    return NULL;
94
9
#endif
95
  /* malloc(0) is undefined; FLAC src convention is to always allocate */
96
9
  if(!size)
97
0
    size++;
98
9
  return malloc(size);
99
11
}
memory.c:safe_malloc_
Line
Count
Source
89
1.15M
{
90
1.15M
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
91
  /* Fail if requested */
92
1.15M
  if(alloc_check())
93
169
    return NULL;
94
1.15M
#endif
95
  /* malloc(0) is undefined; FLAC src convention is to always allocate */
96
1.15M
  if(!size)
97
0
    size++;
98
1.15M
  return malloc(size);
99
1.15M
}
100
101
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
102
static inline void *malloc_(size_t size)
103
44.5k
{
104
  /* Fail if requested */
105
44.5k
  if(alloc_check())
106
5
    return NULL;
107
44.5k
  return malloc(size);
108
44.5k
}
Unexecuted instantiation: encode.c:malloc_
Unexecuted instantiation: foreign_metadata.c:malloc_
Unexecuted instantiation: tool_flac.c:malloc_
Unexecuted instantiation: utf8.c:malloc_
Unexecuted instantiation: iconvert.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
44.5k
{
104
  /* Fail if requested */
105
44.5k
  if(alloc_check())
106
5
    return NULL;
107
44.5k
  return malloc(size);
108
44.5k
}
Unexecuted instantiation: stream_encoder.c:malloc_
Unexecuted instantiation: ogg_decoder_aspect.c:malloc_
Unexecuted instantiation: ogg_helper.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
269k
{
117
269k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
118
  /* Fail if requested */
119
269k
  if(alloc_check())
120
1.14k
    return NULL;
121
268k
#endif
122
268k
  if(!nmemb || !size)
123
0
    return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
124
268k
  return calloc(nmemb, size);
125
268k
}
Unexecuted instantiation: encode.c:safe_calloc_
Unexecuted instantiation: foreign_metadata.c:safe_calloc_
Unexecuted instantiation: tool_flac.c:safe_calloc_
Unexecuted instantiation: utf8.c:safe_calloc_
Unexecuted instantiation: iconvert.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
14.6k
{
117
14.6k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
118
  /* Fail if requested */
119
14.6k
  if(alloc_check())
120
80
    return NULL;
121
14.5k
#endif
122
14.5k
  if(!nmemb || !size)
123
0
    return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
124
14.5k
  return calloc(nmemb, size);
125
14.5k
}
stream_decoder.c:safe_calloc_
Line
Count
Source
116
120k
{
117
120k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
118
  /* Fail if requested */
119
120k
  if(alloc_check())
120
888
    return NULL;
121
119k
#endif
122
119k
  if(!nmemb || !size)
123
0
    return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
124
119k
  return calloc(nmemb, size);
125
119k
}
stream_encoder.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
176
    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: ogg_helper.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
1.19M
{
131
1.19M
  size2 += size1;
132
1.19M
  if(size2 < size1)
133
0
    return 0;
134
1.19M
  return safe_malloc_(size2);
135
1.19M
}
Unexecuted instantiation: encode.c:safe_malloc_add_2op_
Unexecuted instantiation: foreign_metadata.c:safe_malloc_add_2op_
Unexecuted instantiation: tool_flac.c:safe_malloc_add_2op_
Unexecuted instantiation: utf8.c:safe_malloc_add_2op_
Unexecuted instantiation: iconvert.c:safe_malloc_add_2op_
picture.c:safe_malloc_add_2op_
Line
Count
Source
130
4.84k
{
131
4.84k
  size2 += size1;
132
4.84k
  if(size2 < size1)
133
0
    return 0;
134
4.84k
  return safe_malloc_(size2);
135
4.84k
}
Unexecuted instantiation: replaygain_analysis.c:safe_malloc_add_2op_
Unexecuted instantiation: format.c:safe_malloc_add_2op_
Unexecuted instantiation: metadata_iterators.c:safe_malloc_add_2op_
metadata_object.c:safe_malloc_add_2op_
Line
Count
Source
130
11.2k
{
131
11.2k
  size2 += size1;
132
11.2k
  if(size2 < size1)
133
0
    return 0;
134
11.2k
  return safe_malloc_(size2);
135
11.2k
}
stream_decoder.c:safe_malloc_add_2op_
Line
Count
Source
130
25.5k
{
131
25.5k
  size2 += size1;
132
25.5k
  if(size2 < size1)
133
0
    return 0;
134
25.5k
  return safe_malloc_(size2);
135
25.5k
}
Unexecuted instantiation: stream_encoder.c:safe_malloc_add_2op_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_malloc_add_2op_
Unexecuted instantiation: ogg_helper.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
1.15M
{
131
1.15M
  size2 += size1;
132
1.15M
  if(size2 < size1)
133
0
    return 0;
134
1.15M
  return safe_malloc_(size2);
135
1.15M
}
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: encode.c:safe_malloc_add_3op_
Unexecuted instantiation: foreign_metadata.c:safe_malloc_add_3op_
Unexecuted instantiation: tool_flac.c:safe_malloc_add_3op_
Unexecuted instantiation: utf8.c:safe_malloc_add_3op_
Unexecuted instantiation: iconvert.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: stream_encoder.c:safe_malloc_add_3op_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_malloc_add_3op_
Unexecuted instantiation: ogg_helper.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
709
{
150
709
  size2 += size1;
151
709
  if(size2 < size1)
152
0
    return 0;
153
709
  size3 += size2;
154
709
  if(size3 < size2)
155
0
    return 0;
156
709
  size4 += size3;
157
709
  if(size4 < size3)
158
0
    return 0;
159
709
  return safe_malloc_(size4);
160
709
}
Unexecuted instantiation: encode.c:safe_malloc_add_4op_
Unexecuted instantiation: foreign_metadata.c:safe_malloc_add_4op_
Unexecuted instantiation: tool_flac.c:safe_malloc_add_4op_
Unexecuted instantiation: utf8.c:safe_malloc_add_4op_
Unexecuted instantiation: iconvert.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
709
{
150
709
  size2 += size1;
151
709
  if(size2 < size1)
152
0
    return 0;
153
709
  size3 += size2;
154
709
  if(size3 < size2)
155
0
    return 0;
156
709
  size4 += size3;
157
709
  if(size4 < size3)
158
0
    return 0;
159
709
  return safe_malloc_(size4);
160
709
}
Unexecuted instantiation: stream_decoder.c:safe_malloc_add_4op_
Unexecuted instantiation: stream_encoder.c:safe_malloc_add_4op_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_malloc_add_4op_
Unexecuted instantiation: ogg_helper.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: encode.c:safe_malloc_mul_3op_
Unexecuted instantiation: foreign_metadata.c:safe_malloc_mul_3op_
Unexecuted instantiation: tool_flac.c:safe_malloc_mul_3op_
Unexecuted instantiation: utf8.c:safe_malloc_mul_3op_
Unexecuted instantiation: iconvert.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: stream_encoder.c:safe_malloc_mul_3op_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_malloc_mul_3op_
Unexecuted instantiation: ogg_helper.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: encode.c:safe_malloc_mul2add_
Unexecuted instantiation: foreign_metadata.c:safe_malloc_mul2add_
Unexecuted instantiation: tool_flac.c:safe_malloc_mul2add_
Unexecuted instantiation: utf8.c:safe_malloc_mul2add_
Unexecuted instantiation: iconvert.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: stream_encoder.c:safe_malloc_mul2add_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_malloc_mul2add_
Unexecuted instantiation: ogg_helper.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
44.5k
{
189
44.5k
  if(!size1 || (!size2 && !size3))
190
0
    return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
191
44.5k
  size2 += size3;
192
44.5k
  if(size2 < size3)
193
0
    return 0;
194
44.5k
  if(size1 > SIZE_MAX / size2)
195
0
    return 0;
196
44.5k
  return malloc_(size1*size2);
197
44.5k
}
Unexecuted instantiation: encode.c:safe_malloc_muladd2_
Unexecuted instantiation: foreign_metadata.c:safe_malloc_muladd2_
Unexecuted instantiation: tool_flac.c:safe_malloc_muladd2_
Unexecuted instantiation: utf8.c:safe_malloc_muladd2_
Unexecuted instantiation: iconvert.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
44.5k
{
189
44.5k
  if(!size1 || (!size2 && !size3))
190
0
    return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
191
44.5k
  size2 += size3;
192
44.5k
  if(size2 < size3)
193
0
    return 0;
194
44.5k
  if(size1 > SIZE_MAX / size2)
195
0
    return 0;
196
44.5k
  return malloc_(size1*size2);
197
44.5k
}
Unexecuted instantiation: stream_encoder.c:safe_malloc_muladd2_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_malloc_muladd2_
Unexecuted instantiation: ogg_helper.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
1.49M
{
201
1.49M
  void *oldptr;
202
1.49M
  void *newptr;
203
1.49M
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
204
  /* Fail if requested */
205
1.49M
  if(alloc_check() && size > 0) {
206
153
    free(ptr);
207
153
    return NULL;
208
153
  }
209
1.49M
#endif
210
1.49M
  oldptr = ptr;
211
1.49M
  newptr = realloc(ptr, size);
212
1.49M
  if(size > 0 && newptr == 0)
213
0
    free(oldptr);
214
1.49M
  return newptr;
215
1.49M
}
Unexecuted instantiation: encode.c:safe_realloc_
Unexecuted instantiation: foreign_metadata.c:safe_realloc_
Unexecuted instantiation: tool_flac.c:safe_realloc_
Unexecuted instantiation: utf8.c:safe_realloc_
Unexecuted instantiation: iconvert.c:safe_realloc_
Unexecuted instantiation: picture.c:safe_realloc_
replaygain_analysis.c:safe_realloc_
Line
Count
Source
200
5.15k
{
201
5.15k
  void *oldptr;
202
5.15k
  void *newptr;
203
5.15k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
204
  /* Fail if requested */
205
5.15k
  if(alloc_check() && size > 0) {
206
4
    free(ptr);
207
4
    return NULL;
208
4
  }
209
5.15k
#endif
210
5.15k
  oldptr = ptr;
211
5.15k
  newptr = realloc(ptr, size);
212
5.15k
  if(size > 0 && newptr == 0)
213
0
    free(oldptr);
214
5.15k
  return newptr;
215
5.15k
}
format.c:safe_realloc_
Line
Count
Source
200
1.47M
{
201
1.47M
  void *oldptr;
202
1.47M
  void *newptr;
203
1.47M
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
204
  /* Fail if requested */
205
1.47M
  if(alloc_check() && size > 0) {
206
128
    free(ptr);
207
128
    return NULL;
208
128
  }
209
1.47M
#endif
210
1.47M
  oldptr = ptr;
211
1.47M
  newptr = realloc(ptr, size);
212
1.47M
  if(size > 0 && newptr == 0)
213
0
    free(oldptr);
214
1.47M
  return newptr;
215
1.47M
}
Unexecuted instantiation: metadata_iterators.c:safe_realloc_
Unexecuted instantiation: metadata_object.c:safe_realloc_
stream_decoder.c:safe_realloc_
Line
Count
Source
200
6.39k
{
201
6.39k
  void *oldptr;
202
6.39k
  void *newptr;
203
6.39k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
204
  /* Fail if requested */
205
6.39k
  if(alloc_check() && size > 0) {
206
5
    free(ptr);
207
5
    return NULL;
208
5
  }
209
6.39k
#endif
210
6.39k
  oldptr = ptr;
211
6.39k
  newptr = realloc(ptr, size);
212
6.39k
  if(size > 0 && newptr == 0)
213
0
    free(oldptr);
214
6.39k
  return newptr;
215
6.39k
}
Unexecuted instantiation: stream_encoder.c:safe_realloc_
ogg_decoder_aspect.c:safe_realloc_
Line
Count
Source
200
1.63k
{
201
1.63k
  void *oldptr;
202
1.63k
  void *newptr;
203
1.63k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
204
  /* Fail if requested */
205
1.63k
  if(alloc_check() && size > 0) {
206
5
    free(ptr);
207
5
    return NULL;
208
5
  }
209
1.62k
#endif
210
1.62k
  oldptr = ptr;
211
1.62k
  newptr = realloc(ptr, size);
212
1.62k
  if(size > 0 && newptr == 0)
213
0
    free(oldptr);
214
1.62k
  return newptr;
215
1.63k
}
Unexecuted instantiation: ogg_helper.c:safe_realloc_
Unexecuted instantiation: bitwriter.c:safe_realloc_
md5.c:safe_realloc_
Line
Count
Source
200
5.29k
{
201
5.29k
  void *oldptr;
202
5.29k
  void *newptr;
203
5.29k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
204
  /* Fail if requested */
205
5.29k
  if(alloc_check() && size > 0) {
206
11
    free(ptr);
207
11
    return NULL;
208
11
  }
209
5.28k
#endif
210
5.28k
  oldptr = ptr;
211
5.28k
  newptr = realloc(ptr, size);
212
5.28k
  if(size > 0 && newptr == 0)
213
0
    free(oldptr);
214
5.28k
  return newptr;
215
5.29k
}
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
396k
{
220
  /* Fail if requested */
221
396k
  if(alloc_check())
222
245
    return NULL;
223
396k
  return realloc(ptr, size);
224
396k
}
encode.c:realloc_
Line
Count
Source
219
179k
{
220
  /* Fail if requested */
221
179k
  if(alloc_check())
222
36
    return NULL;
223
179k
  return realloc(ptr, size);
224
179k
}
foreign_metadata.c:realloc_
Line
Count
Source
219
185k
{
220
  /* Fail if requested */
221
185k
  if(alloc_check())
222
12
    return NULL;
223
185k
  return realloc(ptr, size);
224
185k
}
Unexecuted instantiation: tool_flac.c:realloc_
Unexecuted instantiation: utf8.c:realloc_
iconvert.c:realloc_
Line
Count
Source
219
2.97k
{
220
  /* Fail if requested */
221
2.97k
  if(alloc_check())
222
163
    return NULL;
223
2.81k
  return realloc(ptr, size);
224
2.97k
}
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
549
{
220
  /* Fail if requested */
221
549
  if(alloc_check())
222
7
    return NULL;
223
542
  return realloc(ptr, size);
224
549
}
Unexecuted instantiation: stream_decoder.c:realloc_
Unexecuted instantiation: stream_encoder.c:realloc_
ogg_decoder_aspect.c:realloc_
Line
Count
Source
219
4.80k
{
220
  /* Fail if requested */
221
4.80k
  if(alloc_check())
222
10
    return NULL;
223
4.79k
  return realloc(ptr, size);
224
4.80k
}
Unexecuted instantiation: ogg_helper.c:realloc_
bitwriter.c:realloc_
Line
Count
Source
219
23.4k
{
220
  /* Fail if requested */
221
23.4k
  if(alloc_check())
222
17
    return NULL;
223
23.4k
  return realloc(ptr, size);
224
23.4k
}
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
3.52k
{
232
3.52k
  size2 += size1;
233
3.52k
  if(size2 < size1)
234
0
    return 0;
235
3.52k
  return realloc_(ptr, size2);
236
3.52k
}
Unexecuted instantiation: encode.c:safe_realloc_nofree_add_2op_
Unexecuted instantiation: foreign_metadata.c:safe_realloc_nofree_add_2op_
Unexecuted instantiation: tool_flac.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
2.97k
{
232
2.97k
  size2 += size1;
233
2.97k
  if(size2 < size1)
234
0
    return 0;
235
2.97k
  return realloc_(ptr, size2);
236
2.97k
}
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
549
{
232
549
  size2 += size1;
233
549
  if(size2 < size1)
234
0
    return 0;
235
549
  return realloc_(ptr, size2);
236
549
}
Unexecuted instantiation: stream_decoder.c:safe_realloc_nofree_add_2op_
Unexecuted instantiation: stream_encoder.c:safe_realloc_nofree_add_2op_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_realloc_nofree_add_2op_
Unexecuted instantiation: ogg_helper.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
0
{
240
0
  size2 += size1;
241
0
  if(size2 < size1) {
242
0
    free(ptr);
243
0
    return 0;
244
0
  }
245
0
  size3 += size2;
246
0
  if(size3 < size2) {
247
0
    free(ptr);
248
0
    return 0;
249
0
  }
250
0
  return safe_realloc_(ptr, size3);
251
0
}
Unexecuted instantiation: encode.c:safe_realloc_add_3op_
Unexecuted instantiation: foreign_metadata.c:safe_realloc_add_3op_
Unexecuted instantiation: tool_flac.c:safe_realloc_add_3op_
Unexecuted instantiation: utf8.c:safe_realloc_add_3op_
Unexecuted instantiation: iconvert.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: stream_encoder.c:safe_realloc_add_3op_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_realloc_add_3op_
Unexecuted instantiation: ogg_helper.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: encode.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: foreign_metadata.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: tool_flac.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: 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: stream_encoder.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_realloc_nofree_add_3op_
Unexecuted instantiation: ogg_helper.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: encode.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: foreign_metadata.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: tool_flac.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: 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: stream_encoder.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_realloc_nofree_add_4op_
Unexecuted instantiation: ogg_helper.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
8.02k
{
280
8.02k
  if(!size1 || !size2)
281
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
282
8.02k
  if(size1 > SIZE_MAX / size2) {
283
0
    free(ptr);
284
0
    return 0;
285
0
  }
286
8.02k
  return safe_realloc_(ptr, size1*size2);
287
8.02k
}
Unexecuted instantiation: encode.c:safe_realloc_mul_2op_
Unexecuted instantiation: foreign_metadata.c:safe_realloc_mul_2op_
Unexecuted instantiation: tool_flac.c:safe_realloc_mul_2op_
Unexecuted instantiation: utf8.c:safe_realloc_mul_2op_
Unexecuted instantiation: iconvert.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
6.39k
{
280
6.39k
  if(!size1 || !size2)
281
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
282
6.39k
  if(size1 > SIZE_MAX / size2) {
283
0
    free(ptr);
284
0
    return 0;
285
0
  }
286
6.39k
  return safe_realloc_(ptr, size1*size2);
287
6.39k
}
Unexecuted instantiation: stream_encoder.c:safe_realloc_mul_2op_
ogg_decoder_aspect.c:safe_realloc_mul_2op_
Line
Count
Source
279
1.63k
{
280
1.63k
  if(!size1 || !size2)
281
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
282
1.63k
  if(size1 > SIZE_MAX / size2) {
283
0
    free(ptr);
284
0
    return 0;
285
0
  }
286
1.63k
  return safe_realloc_(ptr, size1*size2);
287
1.63k
}
Unexecuted instantiation: ogg_helper.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
392k
{
291
392k
  if(!size1 || !size2)
292
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
293
392k
  if(size1 > SIZE_MAX / size2)
294
0
    return 0;
295
392k
  return realloc_(ptr, size1*size2);
296
392k
}
encode.c:safe_realloc_nofree_mul_2op_
Line
Count
Source
290
179k
{
291
179k
  if(!size1 || !size2)
292
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
293
179k
  if(size1 > SIZE_MAX / size2)
294
0
    return 0;
295
179k
  return realloc_(ptr, size1*size2);
296
179k
}
foreign_metadata.c:safe_realloc_nofree_mul_2op_
Line
Count
Source
290
185k
{
291
185k
  if(!size1 || !size2)
292
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
293
185k
  if(size1 > SIZE_MAX / size2)
294
0
    return 0;
295
185k
  return realloc_(ptr, size1*size2);
296
185k
}
Unexecuted instantiation: tool_flac.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: 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: stream_encoder.c:safe_realloc_nofree_mul_2op_
ogg_decoder_aspect.c:safe_realloc_nofree_mul_2op_
Line
Count
Source
290
4.80k
{
291
4.80k
  if(!size1 || !size2)
292
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
293
4.80k
  if(size1 > SIZE_MAX / size2)
294
0
    return 0;
295
4.80k
  return realloc_(ptr, size1*size2);
296
4.80k
}
Unexecuted instantiation: ogg_helper.c:safe_realloc_nofree_mul_2op_
bitwriter.c:safe_realloc_nofree_mul_2op_
Line
Count
Source
290
23.4k
{
291
23.4k
  if(!size1 || !size2)
292
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
293
23.4k
  if(size1 > SIZE_MAX / size2)
294
0
    return 0;
295
23.4k
  return realloc_(ptr, size1*size2);
296
23.4k
}
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: encode.c:safe_realloc_muladd2_
Unexecuted instantiation: foreign_metadata.c:safe_realloc_muladd2_
Unexecuted instantiation: tool_flac.c:safe_realloc_muladd2_
Unexecuted instantiation: utf8.c:safe_realloc_muladd2_
Unexecuted instantiation: iconvert.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: stream_encoder.c:safe_realloc_muladd2_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_realloc_muladd2_
Unexecuted instantiation: ogg_helper.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
364k
{
314
364k
  if(!size1 || (!size2 && !size3))
315
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
316
364k
  size2 += size3;
317
364k
  if(size2 < size3)
318
0
    return 0;
319
364k
  return safe_realloc_nofree_mul_2op_(ptr, size1, size2);
320
364k
}
encode.c:safe_realloc_nofree_muladd2_
Line
Count
Source
313
179k
{
314
179k
  if(!size1 || (!size2 && !size3))
315
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
316
179k
  size2 += size3;
317
179k
  if(size2 < size3)
318
0
    return 0;
319
179k
  return safe_realloc_nofree_mul_2op_(ptr, size1, size2);
320
179k
}
foreign_metadata.c:safe_realloc_nofree_muladd2_
Line
Count
Source
313
185k
{
314
185k
  if(!size1 || (!size2 && !size3))
315
0
    return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
316
185k
  size2 += size3;
317
185k
  if(size2 < size3)
318
0
    return 0;
319
185k
  return safe_realloc_nofree_mul_2op_(ptr, size1, size2);
320
185k
}
Unexecuted instantiation: tool_flac.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: utf8.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: iconvert.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: stream_encoder.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: ogg_decoder_aspect.c:safe_realloc_nofree_muladd2_
Unexecuted instantiation: ogg_helper.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