diff --git a/libavcodec/aic.c b/libavcodec/aic.c
index 70e9f3f10399cb9d1062c816d60adf18f9f9950f..40c18c690f976f284a92f30fc9f29d81f6f64eab 100644
--- a/libavcodec/aic.c
+++ b/libavcodec/aic.c
@@ -223,7 +223,7 @@ static int aic_decode_coeffs(GetBitContext *gb, int16_t *dst,
                     break;
                 GET_CODE(val, coeff_type, coeff_bits);
                 val++;
-                if (val >= 0x10000)
+                if (val >= 0x10000 || val < 0)
                     return AVERROR_INVALIDDATA;
                 dst[scan[idx]] = val;
             } while (idx < num_coeffs - 1);
@@ -233,7 +233,7 @@ static int aic_decode_coeffs(GetBitContext *gb, int16_t *dst,
         for (mb = 0; mb < slice_width; mb++) {
             for (idx = 0; idx < num_coeffs; idx++) {
                 GET_CODE(val, coeff_type, coeff_bits);
-                if (val >= 0x10000)
+                if (val >= 0x10000 || val < 0)
                     return AVERROR_INVALIDDATA;
                 dst[scan[idx]] = val;
             }