]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/qdmc.c
avformat/mux: factorize interleaved write_packet
[ffmpeg] / libavcodec / qdmc.c
index 8f5b7b920d23e5e0c7106853bc19e5d039f134a5..10ceb7aa557cfb1384c0ccd3cc3d663b223a0140 100644 (file)
@@ -367,6 +367,8 @@ static int qdmc_get_vlc(GetBitContext *gb, VLC *table, int flag)
 {
     int v;
 
+    if (get_bits_left(gb) < 1)
+        return AVERROR_INVALIDDATA;
     v = get_vlc2(gb, table->table, table->bits, 1);
     if (v < 0)
         return AVERROR_INVALIDDATA;
@@ -577,9 +579,9 @@ static void add_noise(QDMCContext *s, int ch, int current_subframe)
     for (j = 2; j < s->subframe_size - 1; j++) {
         float rnd_re, rnd_im;
 
-        s->rndval = 214013 * s->rndval + 2531011;
+        s->rndval = 214013U * s->rndval + 2531011;
         rnd_im = ((s->rndval & 0x7FFF) - 16384.0f) * 0.000030517578f * s->noise2_buffer[j];
-        s->rndval = 214013 * s->rndval + 2531011;
+        s->rndval = 214013U * s->rndval + 2531011;
         rnd_re = ((s->rndval & 0x7FFF) - 16384.0f) * 0.000030517578f * s->noise2_buffer[j];
         im[j  ] += rnd_im;
         re[j  ] += rnd_re;