crypto/modes/ocb128.c:494: error: INTEGER_OVERFLOW_L2
  ([0, +oo] - 1):unsigned64 by call to `ocb_lookup_l`.
Showing all 7 steps of the trace


crypto/modes/ocb128.c:494:47: Call
492.   
493.           /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */
494.           OCB_BLOCK *lookup = ocb_lookup_l(ctx, ocb_ntz(i));
                                                     ^
495.           if (!lookup)
496.               return 0;

crypto/modes/ocb128.c:66:5: Assignment
  64.   static u32 ocb_ntz(u64 n)
  65.   {
  66.       u32 cnt = 0;
            ^
  67.   
  68.       /*

crypto/modes/ocb128.c:80:5: Assignment
  78.           cnt++;
  79.       }
  80.       return cnt;
            ^
  81.   }
  82.   

crypto/modes/ocb128.c:494:29: Call
492.   
493.           /* Offset_i = Offset_{i-1} xor L_{ntz(i)} */
494.           OCB_BLOCK *lookup = ocb_lookup_l(ctx, ocb_ntz(i));
                                   ^
495.           if (!lookup)
496.               return 0;

crypto/modes/ocb128.c:154:1: <LHS trace>
152.    * calculate it
153.    */
154. > static OCB_BLOCK *ocb_lookup_l(OCB128_CONTEXT *ctx, size_t index)
155.   {
156.       if (index <= ctx->l_index) {

crypto/modes/ocb128.c:154:1: Parameter `index`
  152.    * calculate it
  153.    */
  154. > static OCB_BLOCK *ocb_lookup_l(OCB128_CONTEXT *ctx, size_t index)
  155.   {
  156.       if (index <= ctx->l_index) {

crypto/modes/ocb128.c:169:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ocb_lookup_l` 
  167.               return NULL;
  168.       }
  169.       ocb_double(ctx->l + (index - 1), ctx->l + index);
             ^
  170.   
  171.       return ctx->l + index;

static OCB_BLOCK *ocb_lookup_l(OCB128_CONTEXT *ctx, size_t index)
{
    if (index <= ctx->l_index) {
        return ctx->l + index;
    }
    ctx->l_index++;
    if (ctx->l_index == ctx->max_l_index) {
        ctx->max_l_index *= 2;
        ctx->l =
            OPENSSL_realloc(ctx->l, ctx->max_l_index * sizeof(OCB_BLOCK));
        if (!ctx->l)
            return NULL;
    }
    ocb_double(ctx->l + (index - 1), ctx->l + index);
    return ctx->l + index;
}
['int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx,\n                          const unsigned char *in, unsigned char *out,\n                          size_t len)\n{\n    u64 i;\n    u64 all_num_blocks, num_blocks;\n    OCB_BLOCK tmp1;\n    OCB_BLOCK tmp2;\n    OCB_BLOCK pad;\n    int last_len;\n    num_blocks = len / 16;\n    all_num_blocks = num_blocks + ctx->blocks_processed;\n    for (i = ctx->blocks_processed + 1; i <= all_num_blocks; i++) {\n        OCB_BLOCK *inblock;\n        OCB_BLOCK *outblock;\n        OCB_BLOCK *lookup = ocb_lookup_l(ctx, ocb_ntz(i));\n        if (!lookup)\n            return 0;\n        ocb_block16_xor(&ctx->offset, lookup, &ctx->offset);\n        inblock = (OCB_BLOCK *)(in + ((i - ctx->blocks_processed - 1) * 16));\n        ocb_block16_xor(&ctx->offset, inblock, &tmp1);\n        ocb_decrypt(ctx, &tmp1, &tmp2, ctx->keydec);\n        outblock =\n            (OCB_BLOCK *)(out + ((i - ctx->blocks_processed - 1) * 16));\n        ocb_block16_xor(&ctx->offset, &tmp2, outblock);\n        ocb_block16_xor(&ctx->checksum, outblock, &ctx->checksum);\n    }\n    last_len = len % 16;\n    if (last_len > 0) {\n        ocb_block16_xor(&ctx->offset, &ctx->l_star, &ctx->offset);\n        ocb_encrypt(ctx, &ctx->offset, &pad, ctx->keyenc);\n        ocb_block_xor(in + (len / 16) * 16, (unsigned char *)&pad, last_len,\n                      out + (num_blocks * 16));\n        memset((void *)&tmp1, 0, 16);\n        memcpy((void *)&tmp1, out + (len / 16) * 16, last_len);\n        ((unsigned char *)(&tmp1))[last_len] = 0x80;\n        ocb_block16_xor(&ctx->checksum, &tmp1, &ctx->checksum);\n    }\n    ctx->blocks_processed = all_num_blocks;\n    return 1;\n}', 'static u32 ocb_ntz(u64 n)\n{\n    u32 cnt = 0;\n    while (!(n & 1)) {\n        n >>= 1;\n        cnt++;\n    }\n    return cnt;\n}', 'static OCB_BLOCK *ocb_lookup_l(OCB128_CONTEXT *ctx, size_t index)\n{\n    if (index <= ctx->l_index) {\n        return ctx->l + index;\n    }\n    ctx->l_index++;\n    if (ctx->l_index == ctx->max_l_index) {\n        ctx->max_l_index *= 2;\n        ctx->l =\n            OPENSSL_realloc(ctx->l, ctx->max_l_index * sizeof(OCB_BLOCK));\n        if (!ctx->l)\n            return NULL;\n    }\n    ocb_double(ctx->l + (index - 1), ctx->l + index);\n    return ctx->l + index;\n}']