#include "internal.h"
#include "pcm.h"
-static int nist_probe(AVProbeData *p)
+static int nist_probe(const AVProbeData *p)
{
if (AV_RL64(p->buf) == AV_RL64("NIST_1A\x0a"))
return AVPROBE_SCORE_MAX;
return 0;
} else if (!memcmp(buffer, "channel_count", 13)) {
sscanf(buffer, "%*s %*s %u", &st->codecpar->channels);
+ if (st->codecpar->channels <= 0 || st->codecpar->channels > INT16_MAX)
+ return AVERROR_INVALIDDATA;
} else if (!memcmp(buffer, "sample_byte_format", 18)) {
sscanf(buffer, "%*s %*s %31s", format);
sscanf(buffer, "%*s %*s %"SCNd64, &st->duration);
} else if (!memcmp(buffer, "sample_n_bytes", 14)) {
sscanf(buffer, "%*s %*s %d", &bps);
+ if (bps > INT16_MAX/8U)
+ return AVERROR_INVALIDDATA;
} else if (!memcmp(buffer, "sample_rate", 11)) {
sscanf(buffer, "%*s %*s %d", &st->codecpar->sample_rate);
} else if (!memcmp(buffer, "sample_sig_bits", 15)) {
sscanf(buffer, "%*s %*s %d", &st->codecpar->bits_per_coded_sample);
+ if (st->codecpar->bits_per_coded_sample <= 0 || st->codecpar->bits_per_coded_sample > INT16_MAX)
+ return AVERROR_INVALIDDATA;
} else {
char key[32], value[32];
if (sscanf(buffer, "%31s %*s %31s", key, value) == 2) {