diff options
-rw-r--r-- | libavcodec/dfpwmdec.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/dfpwmdec.c b/libavcodec/dfpwmdec.c index 27b60a4ea4..e11f393ee4 100644 --- a/libavcodec/dfpwmdec.c +++ b/libavcodec/dfpwmdec.c @@ -106,7 +106,10 @@ static int dfpwm_dec_frame(struct AVCodecContext *ctx, void *data, AVFrame *frame = data; int ret; - frame->nb_samples = packet->size * 8 / ctx->ch_layout.nb_channels; + if (packet->size * 8LL % ctx->ch_layout.nb_channels) + return AVERROR_PATCHWELCOME; + + frame->nb_samples = packet->size * 8LL / ctx->ch_layout.nb_channels; if (frame->nb_samples <= 0) { av_log(ctx, AV_LOG_ERROR, "invalid number of samples in packet\n"); return AVERROR_INVALIDDATA; |