crypto/modes/gcm128.c:614: error: BUFFER_OVERRUN_L3
  Offset added: 12 Size: [0, +oo].
Showing all 3 steps of the trace


crypto/modes/gcm128.c:600:1: <Length trace>
598.   }
599.   
600. > void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx,const unsigned char *iv,size_t len)
601.   {
602.   	const union { long one; char little; } is_endian = {1};

crypto/modes/gcm128.c:600:1: Parameter `ctx->Yi.c[*]`
598.   }
599.   
600. > void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx,const unsigned char *iv,size_t len)
601.   {
602.   	const union { long one; char little; } is_endian = {1};

crypto/modes/gcm128.c:614:3: Array access: Offset added: 12 Size: [0, +oo]
612.   
613.   	if (len==12) {
614.   		memcpy(ctx->Yi.c,iv,12);
         ^
615.   		ctx->Yi.c[15]=1;
616.   		ctr=1;

void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx,const unsigned char *iv,size_t len)
{
	const union { long one; char little; } is_endian = {1};
	unsigned int ctr;
	ctx->Yi.u[0]  = 0;
	ctx->Yi.u[1]  = 0;
	ctx->Xi.u[0]  = 0;
	ctx->Xi.u[1]  = 0;
	ctx->len.u[0] = 0;
	ctx->len.u[1] = 0;
	ctx->res = 0;
	if (len==12) {
		memcpy(ctx->Yi.c,iv,12);
		ctx->Yi.c[15]=1;
		ctr=1;
	}
	else {
		size_t i;
		u64 len0 = len;
		while (len>=16) {
			for (i=0; i<16; ++i) ctx->Yi.c[i] ^= iv[i];
			GCM_MUL(ctx,Yi);
			iv += 16;
			len -= 16;
		}
		if (len) {
			for (i=0; i<len; ++i) ctx->Yi.c[i] ^= iv[i];
			GCM_MUL(ctx,Yi);
		}
		len0 <<= 3;
		if (is_endian.little) {
#ifdef BSWAP8
			ctx->Yi.u[1]  ^= BSWAP8(len0);
#else
			ctx->Yi.c[8]  ^= (u8)(len0>>56);
			ctx->Yi.c[9]  ^= (u8)(len0>>48);
			ctx->Yi.c[10] ^= (u8)(len0>>40);
			ctx->Yi.c[11] ^= (u8)(len0>>32);
			ctx->Yi.c[12] ^= (u8)(len0>>24);
			ctx->Yi.c[13] ^= (u8)(len0>>16);
			ctx->Yi.c[14] ^= (u8)(len0>>8);
			ctx->Yi.c[15] ^= (u8)(len0);
#endif
		}
		else
			ctx->Yi.u[1]  ^= len0;
		GCM_MUL(ctx,Yi);
		if (is_endian.little)
			ctr = GETU32(ctx->Yi.c+12);
		else
			ctr = ctx->Yi.d[3];
	}
	(*ctx->block)(ctx->Yi.c,ctx->EK0.c,ctx->key);
	++ctr;
	if (is_endian.little)
		PUTU32(ctx->Yi.c+12,ctr);
	else
		ctx->Yi.d[3] = ctr;
}
['void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx,const unsigned char *iv,size_t len)\n{\n\tconst union { long one; char little; } is_endian = {1};\n\tunsigned int ctr;\n\tctx->Yi.u[0]  = 0;\n\tctx->Yi.u[1]  = 0;\n\tctx->Xi.u[0]  = 0;\n\tctx->Xi.u[1]  = 0;\n\tctx->len.u[0] = 0;\n\tctx->len.u[1] = 0;\n\tctx->res = 0;\n\tif (len==12) {\n\t\tmemcpy(ctx->Yi.c,iv,12);\n\t\tctx->Yi.c[15]=1;\n\t\tctr=1;\n\t}\n\telse {\n\t\tsize_t i;\n\t\tu64 len0 = len;\n\t\twhile (len>=16) {\n\t\t\tfor (i=0; i<16; ++i) ctx->Yi.c[i] ^= iv[i];\n\t\t\tGCM_MUL(ctx,Yi);\n\t\t\tiv += 16;\n\t\t\tlen -= 16;\n\t\t}\n\t\tif (len) {\n\t\t\tfor (i=0; i<len; ++i) ctx->Yi.c[i] ^= iv[i];\n\t\t\tGCM_MUL(ctx,Yi);\n\t\t}\n\t\tlen0 <<= 3;\n\t\tif (is_endian.little) {\n#ifdef BSWAP8\n\t\t\tctx->Yi.u[1]  ^= BSWAP8(len0);\n#else\n\t\t\tctx->Yi.c[8]  ^= (u8)(len0>>56);\n\t\t\tctx->Yi.c[9]  ^= (u8)(len0>>48);\n\t\t\tctx->Yi.c[10] ^= (u8)(len0>>40);\n\t\t\tctx->Yi.c[11] ^= (u8)(len0>>32);\n\t\t\tctx->Yi.c[12] ^= (u8)(len0>>24);\n\t\t\tctx->Yi.c[13] ^= (u8)(len0>>16);\n\t\t\tctx->Yi.c[14] ^= (u8)(len0>>8);\n\t\t\tctx->Yi.c[15] ^= (u8)(len0);\n#endif\n\t\t}\n\t\telse\n\t\t\tctx->Yi.u[1]  ^= len0;\n\t\tGCM_MUL(ctx,Yi);\n\t\tif (is_endian.little)\n\t\t\tctr = GETU32(ctx->Yi.c+12);\n\t\telse\n\t\t\tctr = ctx->Yi.d[3];\n\t}\n\t(*ctx->block)(ctx->Yi.c,ctx->EK0.c,ctx->key);\n\t++ctr;\n\tif (is_endian.little)\n\t\tPUTU32(ctx->Yi.c+12,ctr);\n\telse\n\t\tctx->Yi.d[3] = ctr;\n}']