libavcodec/apedec.c:483: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned32 by call to `ape_decode_value`.

libavcodec/apedec.c:477:1: Parameter `ctx->riceY.k`
475. }
476. 
477. static void entropy_decode(APEContext *ctx, int blockstodecode, int stereo)
     ^
478. {
479.     int32_t *decoded0 = ctx->decoded[0];

libavcodec/apedec.c:483:23: Call
481. 
482.     while (blockstodecode--) {
483.         *decoded0++ = ape_decode_value(ctx, &ctx->riceY);
                           ^
484.         if (stereo)
485.             *decoded1++ = ape_decode_value(ctx, &ctx->riceX);

libavcodec/apedec.c:407:1: Parameter `rice->k`
  405. }
  406. 
  407. static inline int ape_decode_value(APEContext *ctx, APERice *rice)
       ^
  408. {
  409.     unsigned int x, overflow;

libavcodec/apedec.c:468:5: Call
  466.     }
  467. 
  468.     update_rice(rice, x);
           ^
  469. 
  470.     /* Convert to signed */

libavcodec/apedec.c:396:1: <LHS trace>
394. /** @} */ // group rangecoder
395. 
396. static inline void update_rice(APERice *rice, unsigned int x)
     ^
397. {
398.     int lim = rice->k ? (1 << (rice->k + 4)) : 0;

libavcodec/apedec.c:396:1: Parameter `rice->k`
    394. /** @} */ // group rangecoder
    395. 
    396. static inline void update_rice(APERice *rice, unsigned int x)
         ^
    397. {
    398.     int lim = rice->k ? (1 << (rice->k + 4)) : 0;

libavcodec/apedec.c:402:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ape_decode_value` 
    400. 
    401.     if (rice->ksum < lim)
    402.         rice->k--;
                 ^
    403.     else if (rice->ksum >= (1 << (rice->k + 5)))
    404.         rice->k++;

static inline void update_rice(APERice *rice, unsigned int x)
{
    int lim = rice->k ? (1 << (rice->k + 4)) : 0;
    rice->ksum += ((x + 1) / 2) - ((rice->ksum + 16) >> 5);
    if (rice->ksum < lim)
        rice->k--;
    else if (rice->ksum >= (1 << (rice->k + 5)))
        rice->k++;
}
['static void entropy_decode(APEContext *ctx, int blockstodecode, int stereo)\n{\n    int32_t *decoded0 = ctx->decoded[0];\n    int32_t *decoded1 = ctx->decoded[1];\n    while (blockstodecode--) {\n        *decoded0++ = ape_decode_value(ctx, &ctx->riceY);\n        if (stereo)\n            *decoded1++ = ape_decode_value(ctx, &ctx->riceX);\n    }\n}', 'static inline int ape_decode_value(APEContext *ctx, APERice *rice)\n{\n    unsigned int x, overflow;\n    if (ctx->fileversion < 3990) {\n        int tmpk;\n        overflow = range_get_symbol(ctx, counts_3970, counts_diff_3970);\n        if (overflow == (MODEL_ELEMENTS - 1)) {\n            tmpk = range_decode_bits(ctx, 5);\n            overflow = 0;\n        } else\n            tmpk = (rice->k < 1) ? 0 : rice->k - 1;\n        if (tmpk <= 16)\n            x = range_decode_bits(ctx, tmpk);\n        else if (tmpk <= 32) {\n            x = range_decode_bits(ctx, 16);\n            x |= (range_decode_bits(ctx, tmpk - 16) << 16);\n        } else {\n            av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\\n", tmpk);\n            return AVERROR_INVALIDDATA;\n        }\n        x += overflow << tmpk;\n    } else {\n        int base, pivot;\n        pivot = rice->ksum >> 5;\n        if (pivot == 0)\n            pivot = 1;\n        overflow = range_get_symbol(ctx, counts_3980, counts_diff_3980);\n        if (overflow == (MODEL_ELEMENTS - 1)) {\n            overflow  = range_decode_bits(ctx, 16) << 16;\n            overflow |= range_decode_bits(ctx, 16);\n        }\n        if (pivot < 0x10000) {\n            base = range_decode_culfreq(ctx, pivot);\n            range_decode_update(ctx, 1, base);\n        } else {\n            int base_hi = pivot, base_lo;\n            int bbits = 0;\n            while (base_hi & ~0xFFFF) {\n                base_hi >>= 1;\n                bbits++;\n            }\n            base_hi = range_decode_culfreq(ctx, base_hi + 1);\n            range_decode_update(ctx, 1, base_hi);\n            base_lo = range_decode_culfreq(ctx, 1 << bbits);\n            range_decode_update(ctx, 1, base_lo);\n            base = (base_hi << bbits) + base_lo;\n        }\n        x = base + overflow * pivot;\n    }\n    update_rice(rice, x);\n    if (x & 1)\n        return (x >> 1) + 1;\n    else\n        return -(x >> 1);\n}', 'static inline void update_rice(APERice *rice, unsigned int x)\n{\n    int lim = rice->k ? (1 << (rice->k + 4)) : 0;\n    rice->ksum += ((x + 1) / 2) - ((rice->ksum + 16) >> 5);\n    if (rice->ksum < lim)\n        rice->k--;\n    else if (rice->ksum >= (1 << (rice->k + 5)))\n        rice->k++;\n}']