The following issues were found
libavformat/matroska.c
2 issues
Line: 128
Column: 7
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
{ 0 }
};
const char * const ff_matroska_video_stereo_mode[MATROSKA_VIDEO_STEREOMODE_TYPE_NB] = {
"mono",
"left_right",
"bottom_top",
"top_bottom",
"checkerboard_rl",
Reported by FlawFinder.
Line: 146
Column: 7
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
"block_rl",
};
const char * const ff_matroska_video_stereo_plane[MATROSKA_VIDEO_STEREO_PLANE_COUNT] = {
"left",
"right",
"background",
};
Reported by FlawFinder.
libavcodec/v210enc.c
2 issues
Line: 139
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
uint8_t *buf = av_packet_new_side_data(pkt, AV_PKT_DATA_A53_CC, side_data->size);
if (!buf)
return AVERROR(ENOMEM);
memcpy(buf, side_data->data, side_data->size);
}
side_data = av_frame_get_side_data(pic, AV_FRAME_DATA_AFD);
if (side_data && side_data->size) {
uint8_t *buf = av_packet_new_side_data(pkt, AV_PKT_DATA_AFD, side_data->size);
Reported by FlawFinder.
Line: 147
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
uint8_t *buf = av_packet_new_side_data(pkt, AV_PKT_DATA_AFD, side_data->size);
if (!buf)
return AVERROR(ENOMEM);
memcpy(buf, side_data->data, side_data->size);
}
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1;
return 0;
Reported by FlawFinder.
libavcodec/htmlsubtitles.c
2 issues
Line: 91
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
}
struct font_tag {
char face[128];
int size;
uint32_t color;
};
/*
Reported by FlawFinder.
Line: 131
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
*/
int ff_htmlmarkup_to_ass(void *log_ctx, AVBPrint *dst, const char *in)
{
char *param, buffer[128];
int len, tag_close, sptr = 0, line_start = 1, an = 0, end = 0;
int closing_brace_missing = 0;
int i, likely_a_tag;
/*
Reported by FlawFinder.
libavformat/lrcdec.c
2 issues
Line: 185
Column: 20
CWE codes:
120
20
Suggestion:
Specify a limit to %s, or use a different input function
*right_bracket_offset = *comma_offset = '\0';
if(strcmp(line.str + 1, "offset") ||
sscanf(comma_offset + 1, "%"SCNd64, &lrc->ts_offset) != 1) {
av_dict_set(&s->metadata, line.str + 1, comma_offset + 1, 0);
}
lrc->ts_offset = av_clip64(lrc->ts_offset, INT64_MIN/4, INT64_MAX/4);
*comma_offset = ':';
Reported by FlawFinder.
Line: 147
Column: 36
CWE codes:
126
// Metadata items exist in ff_lrc_metadata_conv
for(metadata_item = ff_lrc_metadata_conv;
metadata_item->native; metadata_item++) {
size_t metadata_item_len = strlen(metadata_item->native);
if(p->buf[offset + metadata_item_len] == ':' &&
!memcmp(p->buf + offset, metadata_item->native, metadata_item_len)) {
return 40;
}
}
Reported by FlawFinder.
libavcodec/ttmlenc.c
2 issues
Line: 355
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
avctx->extradata_size =
TTMLENC_EXTRADATA_SIGNATURE_SIZE + additional_extradata_size;
memcpy(avctx->extradata, TTMLENC_EXTRADATA_SIGNATURE,
TTMLENC_EXTRADATA_SIGNATURE_SIZE);
if (additional_extradata_size)
memcpy(avctx->extradata + TTMLENC_EXTRADATA_SIGNATURE_SIZE,
s->buffer.str, additional_extradata_size);
Reported by FlawFinder.
Line: 359
Column: 9
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
TTMLENC_EXTRADATA_SIGNATURE_SIZE);
if (additional_extradata_size)
memcpy(avctx->extradata + TTMLENC_EXTRADATA_SIGNATURE_SIZE,
s->buffer.str, additional_extradata_size);
av_bprint_clear(&s->buffer);
return 0;
Reported by FlawFinder.
libavformat/libgme.c
2 issues
Line: 67
Column: 39
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
return AVERROR_STREAM_NOT_FOUND;
*duration = info->length;
add_meta(s, "system", info->system);
add_meta(s, "game", info->game);
add_meta(s, "song", info->song);
add_meta(s, "author", info->author);
add_meta(s, "copyright", info->copyright);
add_meta(s, "comment", info->comment);
Reported by FlawFinder.
Line: 61
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
{
GMEContext *gme = s->priv_data;
gme_info_t *info = NULL;
char buf[30];
if (gme_track_info(gme->music_emu, &info, gme->track_index))
return AVERROR_STREAM_NOT_FOUND;
*duration = info->length;
Reported by FlawFinder.
doc/examples/filtering_audio.c
2 issues
Line: 111
Column: 5
CWE codes:
134
Suggestion:
Use a constant for the format specification
/* buffer audio source: the decoded frames from the decoder will be inserted here. */
if (!dec_ctx->channel_layout)
dec_ctx->channel_layout = av_get_default_channel_layout(dec_ctx->channels);
snprintf(args, sizeof(args),
"time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%"PRIx64,
time_base.num, time_base.den, dec_ctx->sample_rate,
av_get_sample_fmt_name(dec_ctx->sample_fmt), dec_ctx->channel_layout);
ret = avfilter_graph_create_filter(&buffersrc_ctx, abuffersrc, "in",
args, NULL, filter_graph);
Reported by FlawFinder.
Line: 90
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
static int init_filters(const char *filters_descr)
{
char args[512];
int ret = 0;
const AVFilter *abuffersrc = avfilter_get_by_name("abuffer");
const AVFilter *abuffersink = avfilter_get_by_name("abuffersink");
AVFilterInOut *outputs = avfilter_inout_alloc();
AVFilterInOut *inputs = avfilter_inout_alloc();
Reported by FlawFinder.
libavformat/libmodplug.c
2 issues
Line: 122
Column: 13
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
unsigned i, n = 0; \
\
for (i = 0; i < n_## entry_name ##s; i++) { \
char item_name[64] = {0}; \
fname(f, i, item_name); \
if (!*item_name) \
continue; \
if (n) \
av_dict_set(&s->metadata, #entry_name, "\n", AV_DICT_APPEND); \
Reported by FlawFinder.
Line: 314
Column: 17
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
memset(pkt->data, 0, modplug->fsize);
if (modplug->print_textinfo) {
char intbuf[32];
PRINT_INFO(0, "speed", VAR_SPEED);
PRINT_INFO(1, "tempo", VAR_TEMPO);
PRINT_INFO(2, "order", VAR_ORDER);
PRINT_INFO(3, "pattern", VAR_PATTERN);
PRINT_INFO(4, "row", VAR_ROW);
Reported by FlawFinder.
libavcodec/truehd_core_bsf.c
2 issues
Line: 106
Column: 13
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
av_assert1(reduce >= 0 && reduce % 2 == 0);
if (have_header) {
memcpy(header, pkt->data + 4, 28);
header[16] = (header[16] & 0x0c) | (FFMIN(s->hdr.num_substreams, 3) << 4);
header[17] &= 0x7f;
header[25] &= 0xfe;
AV_WL16(header + 26, ff_mlp_checksum16(header, 26));
}
Reported by FlawFinder.
Line: 156
Column: 13
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
AV_WB16(pkt->data, auheader);
if (have_header)
memcpy(pkt->data + 4, header, 28);
}
fail:
if (ret < 0)
av_packet_unref(pkt);
Reported by FlawFinder.
libavformat/jvdec.c
2 issues
Line: 57
Column: 51
CWE codes:
126
static int read_probe(const AVProbeData *pd)
{
if (pd->buf[0] == 'J' && pd->buf[1] == 'V' && strlen(MAGIC) + 4 <= pd->buf_size &&
!memcmp(pd->buf + 4, MAGIC, strlen(MAGIC)))
return AVPROBE_SCORE_MAX;
return 0;
}
Reported by FlawFinder.
Line: 58
Column: 37
CWE codes:
126
static int read_probe(const AVProbeData *pd)
{
if (pd->buf[0] == 'J' && pd->buf[1] == 'V' && strlen(MAGIC) + 4 <= pd->buf_size &&
!memcmp(pd->buf + 4, MAGIC, strlen(MAGIC)))
return AVPROBE_SCORE_MAX;
return 0;
}
static int read_close(AVFormatContext *s)
Reported by FlawFinder.