id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_45854
static int get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509_CRL **pdcrl, X509 **pissuer, int *pscore, unsigned int *preasons, STACK_OF(X509_CRL) *crls) { int i, crl_score, best_score = *pscore; unsigned int reasons, best_reasons; X509 *x = ctx->current_cert; X509_CRL *crl, *best_crl = NULL; X509 *crl_issuer, *best_crl_issuer = NULL; for (i = 0; i < sk_X509_CRL_num(crls); i++) { crl = sk_X509_CRL_value(crls, i); reasons = *preasons; crl_score = get_crl_score(ctx, &crl_issuer, &reasons, crl, x); if (crl_score > best_score) { best_crl = crl; best_crl_issuer = crl_issuer; best_score = crl_score; best_reasons = reasons; } } if (best_crl) { if (*pcrl) X509_CRL_free(*pcrl); *pcrl = best_crl; *pissuer = best_crl_issuer; *pscore = best_score; *preasons = best_reasons; CRYPTO_add(&best_crl->references, 1, CRYPTO_LOCK_X509_CRL); if (*pdcrl) { X509_CRL_free(*pdcrl); *pdcrl = NULL; } get_delta_sk(ctx, pdcrl, pscore, best_crl, crls); } if (best_score >= CRL_SCORE_VALID) return 1; return 0; } crypto/x509/x509_vfy.c:849: error: UNINITIALIZED_VALUE The value read from best_reasons was never initialized. Showing all 1 steps of the trace crypto/x509/x509_vfy.c:849:3: 847. *pissuer = best_crl_issuer; 848. *pscore = best_score; 849. > *preasons = best_reasons; 850. CRYPTO_add(&best_crl->references, 1, CRYPTO_LOCK_X509_CRL); 851. if (*pdcrl)
https://github.com/openssl/openssl/blob/d43c4497ce1611373c3a3e5b433dfde4907d1a69/crypto/x509/x509_vfy.c/#L849
d2a_code_trace_data_45855
char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) { const X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; if (num > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_IA5STRING) { if (num > (int)sizeof(ebcdic_buf)) num = sizeof(ebcdic_buf); ascii2ebcdic(ebcdic_buf, q, num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (l > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); end: BUF_MEM_free(b); return (NULL); } apps/apps.c:1139: error: BUFFER_OVERRUN_L3 Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace apps/apps.c:1139:15: Call 1137. } 1138. if (lflags == XN_FLAG_COMPAT) { 1139. buf = X509_NAME_oneline(nm, 0, 0); ^ 1140. BIO_puts(out, buf); 1141. BIO_puts(out, "\n"); crypto/x509/x509_obj.c:25:1: <Offset trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `len` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: <Length trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `*buf` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:56:9: Array access: Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline` 54. OPENSSL_free(b); 55. } 56. strncpy(buf, "NO X509_NAME", len); ^ 57. buf[len - 1] = '\0'; 58. return buf;
https://github.com/openssl/openssl/blob/cdb2a60347f988037d29adc7e4415e9c66c8a5a5/crypto/x509/x509_obj.c/#L56
d2a_code_trace_data_45856
static void do_video_stats(AVFormatContext *os, AVOutputStream *ost, int frame_size) { AVCodecContext *enc; int frame_number; double ti1, bitrate, avg_bitrate; if (!vstats_file) { vstats_file = fopen(vstats_filename, "w"); if (!vstats_file) { perror("fopen"); ffmpeg_exit(1); } } enc = ost->st->codec; if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { frame_number = ost->frame_number; fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); if (enc->flags&CODEC_FLAG_PSNR) fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0]/(enc->width*enc->height*255.0*255.0))); fprintf(vstats_file,"f_size= %6d ", frame_size); ti1 = ost->sync_opts * av_q2d(enc->time_base); if (ti1 < 0.01) ti1 = 0.01; bitrate = (frame_size * 8) / av_q2d(enc->time_base) / 1000.0; avg_bitrate = (double)(video_size * 8) / ti1 / 1000.0; fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", (double)video_size / 1024, ti1, bitrate, avg_bitrate); fprintf(vstats_file,"type= %c\n", av_get_pict_type_char(enc->coded_frame->pict_type)); } } ffmpeg.c:1257: error: Null Dereference pointer `vstats_file` last assigned on line 1247 could be null and is dereferenced by call to `fprintf()` at line 1257, column 9. ffmpeg.c:1238:1: start of procedure do_video_stats() 1236. } 1237. 1238. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost, ^ 1239. int frame_size) 1240. { ffmpeg.c:1246:10: Taking true branch 1244. 1245. /* this is executed just the first time do_video_stats is called */ 1246. if (!vstats_file) { ^ 1247. vstats_file = fopen(vstats_filename, "w"); 1248. if (!vstats_file) { ffmpeg.c:1247:9: 1245. /* this is executed just the first time do_video_stats is called */ 1246. if (!vstats_file) { 1247. vstats_file = fopen(vstats_filename, "w"); ^ 1248. if (!vstats_file) { 1249. perror("fopen"); ffmpeg.c:1248:14: Taking true branch 1246. if (!vstats_file) { 1247. vstats_file = fopen(vstats_filename, "w"); 1248. if (!vstats_file) { ^ 1249. perror("fopen"); 1250. ffmpeg_exit(1); ffmpeg.c:1249:13: 1247. vstats_file = fopen(vstats_filename, "w"); 1248. if (!vstats_file) { 1249. perror("fopen"); ^ 1250. ffmpeg_exit(1); 1251. } ffmpeg.c:1250:13: Skipping ffmpeg_exit(): empty list of specs 1248. if (!vstats_file) { 1249. perror("fopen"); 1250. ffmpeg_exit(1); ^ 1251. } 1252. } ffmpeg.c:1254:5: 1252. } 1253. 1254. enc = ost->st->codec; ^ 1255. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1256. frame_number = ost->frame_number; ffmpeg.c:1255:9: Taking true branch 1253. 1254. enc = ost->st->codec; 1255. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { ^ 1256. frame_number = ost->frame_number; 1257. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); ffmpeg.c:1256:9: 1254. enc = ost->st->codec; 1255. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1256. frame_number = ost->frame_number; ^ 1257. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); 1258. if (enc->flags&CODEC_FLAG_PSNR) ffmpeg.c:1257:9: 1255. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1256. frame_number = ost->frame_number; 1257. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); ^ 1258. if (enc->flags&CODEC_FLAG_PSNR) 1259. fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0]/(enc->width*enc->height*255.0*255.0)));
https://github.com/libav/libav/blob/eced8fa02ea237abd9c6a6e9287bb7524addb8f4/ffmpeg.c/#L1257
d2a_code_trace_data_45857
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; return 1; } ssl/t1_reneg.c:56: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 12 steps of the trace ssl/t1_reneg.c:55:10: Call 53. int ssl_add_serverhello_renegotiate_ext(SSL *s, WPACKET *pkt) 54. { 55. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_renegotiate) ^ 56. || !WPACKET_start_sub_packet_u16(pkt) 57. || !WPACKET_start_sub_packet_u8(pkt) ssl/packet.c:261:1: Parameter `pkt->buf->length` 259. } 260. 261. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 262. { 263. unsigned char *data; ssl/t1_reneg.c:56:17: Call 54. { 55. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_renegotiate) 56. || !WPACKET_start_sub_packet_u16(pkt) ^ 57. || !WPACKET_start_sub_packet_u8(pkt) 58. || !WPACKET_memcpy(pkt, s->s3->previous_client_finished, ssl/packet.c:224:1: Parameter `pkt->written` 222. } 223. 224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 225. { 226. WPACKET_SUB *sub; ssl/packet.c:248:10: Call 246. } 247. 248. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 249. return 0; 250. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:36:1: <LHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `pkt->buf->length` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: <RHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `len` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:46:9: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 4]):unsigned64 by call to `WPACKET_start_sub_packet_len__` 44. return 0; 45. 46. if (pkt->buf->length - pkt->written < len) { ^ 47. size_t newlen; 48. size_t reflen;
https://github.com/openssl/openssl/blob/e4e1aa903e624044d3319622fc50222f1b2c7328/ssl/packet.c/#L46
d2a_code_trace_data_45858
static int opt_preset(const char *opt, const char *arg) { FILE *f=NULL; char filename[1000], tmp[1000], tmp2[1000], line[1000]; char *codec_name = *opt == 'v' ? video_codec_name : *opt == 'a' ? audio_codec_name : subtitle_codec_name; if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { fprintf(stderr, "File for preset '%s' not found\n", arg); ffmpeg_exit(1); } while(!feof(f)){ int e= fscanf(f, "%999[^\n]\n", line) - 1; if(line[0] == '#' && !e) continue; e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2; if(e){ fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line); ffmpeg_exit(1); } if(!strcmp(tmp, "acodec")){ opt_audio_codec(tmp2); }else if(!strcmp(tmp, "vcodec")){ opt_video_codec(tmp2); }else if(!strcmp(tmp, "scodec")){ opt_subtitle_codec(tmp2); }else if(!strcmp(tmp, "dcodec")){ opt_data_codec(tmp2); }else if(opt_default(tmp, tmp2) < 0){ fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2); ffmpeg_exit(1); } } fclose(f); return 0; } ffmpeg.c:4249: error: Null Dereference pointer `f` last assigned on line 4244 could be null and is dereferenced by call to `feof()` at line 4249, column 12. ffmpeg.c:4236:1: start of procedure opt_preset() 4234. } 4235. 4236. static int opt_preset(const char *opt, const char *arg) ^ 4237. { 4238. FILE *f=NULL; ffmpeg.c:4238:5: 4236. static int opt_preset(const char *opt, const char *arg) 4237. { 4238. FILE *f=NULL; ^ 4239. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4240. char *codec_name = *opt == 'v' ? video_codec_name : ffmpeg.c:4240:24: Condition is false 4238. FILE *f=NULL; 4239. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4240. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4241. *opt == 'a' ? audio_codec_name : 4242. subtitle_codec_name; ffmpeg.c:4241:24: Condition is false 4239. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4240. char *codec_name = *opt == 'v' ? video_codec_name : 4241. *opt == 'a' ? audio_codec_name : ^ 4242. subtitle_codec_name; 4243. ffmpeg.c:4240:24: 4238. FILE *f=NULL; 4239. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4240. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4241. *opt == 'a' ? audio_codec_name : 4242. subtitle_codec_name; ffmpeg.c:4240:5: 4238. FILE *f=NULL; 4239. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4240. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4241. *opt == 'a' ? audio_codec_name : 4242. subtitle_codec_name; ffmpeg.c:4244:64: Condition is false 4242. subtitle_codec_name; 4243. 4244. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { ^ 4245. fprintf(stderr, "File for preset '%s' not found\n", arg); 4246. ffmpeg_exit(1); ffmpeg.c:4244:11: Taking true branch 4242. subtitle_codec_name; 4243. 4244. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { ^ 4245. fprintf(stderr, "File for preset '%s' not found\n", arg); 4246. ffmpeg_exit(1); ffmpeg.c:4245:9: 4243. 4244. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { 4245. fprintf(stderr, "File for preset '%s' not found\n", arg); ^ 4246. ffmpeg_exit(1); 4247. } ffmpeg.c:4246:9: Skipping ffmpeg_exit(): empty list of specs 4244. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { 4245. fprintf(stderr, "File for preset '%s' not found\n", arg); 4246. ffmpeg_exit(1); ^ 4247. } 4248. ffmpeg.c:4249:12: 4247. } 4248. 4249. while(!feof(f)){ ^ 4250. int e= fscanf(f, "%999[^\n]\n", line) - 1; 4251. if(line[0] == '#' && !e)
https://github.com/libav/libav/blob/41e21e4db623ebd77f431a6f30cf21d62d9e1f33/ffmpeg.c/#L4249
d2a_code_trace_data_45859
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecdsa_ossl.c:305: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul`. Showing all 16 steps of the trace crypto/ec/ecdsa_ossl.c:239:5: Call 237. } 238. 239. BN_CTX_start(ctx); ^ 240. tmp = BN_CTX_get(ctx); 241. m = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/ec/ecdsa_ossl.c:305:14: Call 303. 304. /* tmp := blind * priv_key * r mod order */ 305. if (!BN_mod_mul(tmp, blind, priv_key, order, ctx)) { ^ 306. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); 307. goto err; crypto/bn/bn_mod.c:73:1: Parameter `ctx->stack.depth` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/bn/bn_mod.c:83:5: Call 81. bn_check_top(m); 82. 83. BN_CTX_start(ctx); ^ 84. if ((t = BN_CTX_get(ctx)) == NULL) 85. goto err; crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mod.c:90:14: Call 88. goto err; 89. } else { 90. if (!BN_mul(t, a, b, ctx)) ^ 91. goto err; 92. } crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = 0; crypto/bn/bn_mul.c:523:5: Call 521. top = al + bl; 522. 523. BN_CTX_start(ctx); ^ 524. if ((r == a) || (r == b)) { 525. if ((rr = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mul.c:608:5: Call 606. err: 607. bn_check_top(r); 608. BN_CTX_end(ctx); ^ 609. return ret; 610. } crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:274:1: <LHS trace> 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:274:1: Parameter `st->depth` 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:276:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul` 274. static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; ^ 277. } 278.
https://github.com/openssl/openssl/blob/ddb634fe6f9aeea34fe036cf804903b4240d38ac/crypto/bn/bn_ctx.c/#L276
d2a_code_trace_data_45860
static int JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) { if (data->bufferbytesleft==0) { uint32 m; if (data->filebytesleft==0) return(0); if (!data->filepositioned) { TIFFSeekFile(data->tif,data->fileoffset,SEEK_SET); data->filepositioned=1; } m=data->buffersize; if ((uint64)m>data->filebytesleft) m=(uint32)data->filebytesleft; assert(m<0x80000000UL); if (TIFFReadFile(data->tif,data->buffer,(tmsize_t)m)!=(tmsize_t)m) return(0); data->buffercurrentbyte=data->buffer; data->bufferbytesleft=m; data->fileoffset+=m; data->filebytesleft-=m; } *result=*data->buffercurrentbyte; data->buffercurrentbyte++; data->bufferbytesleft--; return(1); } libtiff/tif_jpeg.c:892: error: Integer Overflow L2 ([1, `data->filebytesleft`] - [0, 2147483647]):unsigned64 by call to `JPEGFixupTagsSubsamplingReadByte`. libtiff/tif_jpeg.c:885:1: Parameter `data->filebytesleft` 883. } 884. 885. static int ^ 886. JPEGFixupTagsSubsamplingReadWord(struct JPEGFixupTagsSubsamplingData* data, uint16* result) 887. { libtiff/tif_jpeg.c:890:7: Call 888. uint8 ma; 889. uint8 mb; 890. if (!JPEGFixupTagsSubsamplingReadByte(data,&ma)) ^ 891. return(0); 892. if (!JPEGFixupTagsSubsamplingReadByte(data,&mb)) libtiff/tif_jpeg.c:855:1: Parameter `data->filebytesleft` 853. } 854. 855. static int ^ 856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) 857. { libtiff/tif_jpeg.c:892:7: Call 890. if (!JPEGFixupTagsSubsamplingReadByte(data,&ma)) 891. return(0); 892. if (!JPEGFixupTagsSubsamplingReadByte(data,&mb)) ^ 893. return(0); 894. *result=(ma<<8)|mb; libtiff/tif_jpeg.c:855:1: <LHS trace> 853. } 854. 855. static int ^ 856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) 857. { libtiff/tif_jpeg.c:855:1: Parameter `data->filebytesleft` 853. } 854. 855. static int ^ 856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) 857. { libtiff/tif_jpeg.c:872:7: <RHS trace> 870. m=(uint32)data->filebytesleft; 871. assert(m<0x80000000UL); 872. if (TIFFReadFile(data->tif,data->buffer,(tmsize_t)m)!=(tmsize_t)m) ^ 873. return(0); 874. data->buffercurrentbyte=data->buffer; libtiff/tif_jpeg.c:872:7: Unknown value from: non-const function 870. m=(uint32)data->filebytesleft; 871. assert(m<0x80000000UL); 872. if (TIFFReadFile(data->tif,data->buffer,(tmsize_t)m)!=(tmsize_t)m) ^ 873. return(0); 874. data->buffercurrentbyte=data->buffer; libtiff/tif_jpeg.c:877:3: Binary operation: ([1, data->filebytesleft] - [0, 2147483647]):unsigned64 by call to `JPEGFixupTagsSubsamplingReadByte` 875. data->bufferbytesleft=m; 876. data->fileoffset+=m; 877. data->filebytesleft-=m; ^ 878. } 879. *result=*data->buffercurrentbyte;
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_jpeg.c/#L877
d2a_code_trace_data_45861
void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb) { BN_ULONG *rr; if (na < nb) { int itmp; BN_ULONG *ltmp; itmp = na; na = nb; nb = itmp; ltmp = a; a = b; b = ltmp; } rr = &(r[na]); if (nb <= 0) { (void)bn_mul_words(r, a, na, 0); return; } else rr[0] = bn_mul_words(r, a, na, b[0]); for (;;) { if (--nb <= 0) return; rr[1] = bn_mul_add_words(&(r[1]), a, na, b[1]); if (--nb <= 0) return; rr[2] = bn_mul_add_words(&(r[2]), a, na, b[2]); if (--nb <= 0) return; rr[3] = bn_mul_add_words(&(r[3]), a, na, b[3]); if (--nb <= 0) return; rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]); rr += 4; r += 4; b += 4; } } test/bntest.c:238: error: BUFFER_OVERRUN_L3 Offset: [4, +oo] (⇐ [0, +oo] + 4) Size: [0, 8388607] by call to `BN_div_recp`. Showing all 14 steps of the trace test/bntest.c:237:9: Call 235. a->neg = rand_neg(); 236. b->neg = rand_neg(); 237. BN_RECP_CTX_set(recp, b, ctx); ^ 238. BN_div_recp(d, c, a, recp, ctx); 239. BN_mul(e, d, b, ctx); crypto/bn/bn_recp.c:44:1: Parameter `*recp->N.d` 42. } 43. 44. > int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx) 45. { 46. if (!BN_copy(&(recp->N), d)) crypto/bn/bn_recp.c:46:10: Call 44. int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx) 45. { 46. if (!BN_copy(&(recp->N), d)) ^ 47. return 0; 48. BN_zero(&(recp->Nr)); crypto/bn/bn_lib.c:362:1: Parameter `*a->d` 360. } 361. 362. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 363. { 364. int i; test/bntest.c:238:9: Call 236. b->neg = rand_neg(); 237. BN_RECP_CTX_set(recp, b, ctx); 238. BN_div_recp(d, c, a, recp, ctx); ^ 239. BN_mul(e, d, b, ctx); 240. BN_add(d, e, c); crypto/bn/bn_recp.c:83:1: Parameter `*recp->N.d` 81. } 82. 83. > int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, 84. BN_RECP_CTX *recp, BN_CTX *ctx) 85. { crypto/bn/bn_recp.c:145:10: Call 143. d->neg = 0; 144. 145. if (!BN_mul(b, &(recp->N), d, ctx)) ^ 146. goto err; 147. if (!BN_usub(r, m, b)) crypto/bn/bn_mul.c:828:1: Parameter `*a->d` 826. #endif /* BN_RECURSION */ 827. 828. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 829. { 830. int ret = 0; crypto/bn/bn_mul.c:909:17: Call 907. if (bn_wexpand(rr, k * 4) == NULL) 908. goto err; 909. bn_mul_part_recursive(rr->d, a->d, b->d, ^ 910. j, al - j, bl - j, t->d); 911. } else { /* al <= j || bl <= j */ crypto/bn/bn_mul.c:480:1: Parameter `*a` 478. */ 479. /* tnX may not be negative but less than n */ 480. > void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n, 481. int tna, int tnb, BN_ULONG *t) 482. { crypto/bn/bn_mul.c:488:9: Call 486. 487. if (n < 8) { 488. bn_mul_normal(r, a, n + tna, b, n + tnb); ^ 489. return; 490. } crypto/bn/bn_mul.c:983:1: <Length trace> 981. } 982. 983. > void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb) 984. { 985. BN_ULONG *rr; crypto/bn/bn_mul.c:983:1: Parameter `*b` 981. } 982. 983. > void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb) 984. { 985. BN_ULONG *rr; crypto/bn/bn_mul.c:1018:50: Array access: Offset: [4, +oo] (⇐ [0, +oo] + 4) Size: [0, 8388607] by call to `BN_div_recp` 1016. if (--nb <= 0) 1017. return; 1018. rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]); ^ 1019. rr += 4; 1020. r += 4;
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_mul.c/#L1018
d2a_code_trace_data_45862
static inline void refill_32(BitstreamContext *bc) { if (bc->ptr >= bc->buffer_end) return; #ifdef BITSTREAM_READER_LE bc->bits = (uint64_t)AV_RL32(bc->ptr) << bc->bits_left | bc->bits; #else bc->bits = bc->bits | (uint64_t)AV_RB32(bc->ptr) << (32 - bc->bits_left); #endif bc->ptr += 4; bc->bits_left += 32; } libavformat/rtpenc_h263_rfc2190.c:116: error: Integer Overflow L2 (32 - [0, 64]):unsigned32 by call to `bitstream_read`. libavformat/rtpenc_h263_rfc2190.c:115:5: Call 113. s->timestamp = s->cur_timestamp; 114. 115. bitstream_init(&bc, buf, size * 8); ^ 116. if (bitstream_read(&bc, 22) == 0x20) { /* Picture Start Code */ 117. info.tr = bitstream_read(&bc, 8); libavcodec/bitstream.h:85:9: Assignment 83. bc->buffer = 84. bc->ptr = NULL; 85. bc->bits_left = 0; ^ 86. return AVERROR_INVALIDDATA; 87. } libavformat/rtpenc_h263_rfc2190.c:116:9: Call 114. 115. bitstream_init(&bc, buf, size * 8); 116. if (bitstream_read(&bc, 22) == 0x20) { /* Picture Start Code */ ^ 117. info.tr = bitstream_read(&bc, 8); 118. bitstream_skip(&bc, 2); /* PTYPE start, H.261 disambiguation */ libavcodec/bitstream.h:183:1: Parameter `n` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/bitstream.h:189:9: Call 187. 188. if (n > bc->bits_left) { 189. refill_32(bc); ^ 190. if (bc->bits_left < 32) 191. bc->bits_left = n; libavcodec/bitstream.h:60:1: <RHS trace> 58. } 59. 60. static inline void refill_32(BitstreamContext *bc) ^ 61. { 62. if (bc->ptr >= bc->buffer_end) libavcodec/bitstream.h:60:1: Parameter `bc->bits_left` 58. } 59. 60. static inline void refill_32(BitstreamContext *bc) ^ 61. { 62. if (bc->ptr >= bc->buffer_end) libavcodec/bitstream.h:68:5: Binary operation: (32 - [0, 64]):unsigned32 by call to `bitstream_read` 66. bc->bits = (uint64_t)AV_RL32(bc->ptr) << bc->bits_left | bc->bits; 67. #else 68. bc->bits = bc->bits | (uint64_t)AV_RB32(bc->ptr) << (32 - bc->bits_left); ^ 69. #endif 70. bc->ptr += 4;
https://github.com/libav/libav/blob/7ff018c1cb43a5fe5ee2049d325cdd785852067a/libavcodec/bitstream.h/#L68
d2a_code_trace_data_45863
static void new_subtitle_stream(AVFormatContext *oc, int file_idx) { AVStream *st; AVOutputStream *ost; AVCodec *codec=NULL; AVCodecContext *subtitle_enc; enum CodecID codec_id = CODEC_ID_NONE; st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); if (!st) { fprintf(stderr, "Could not alloc stream\n"); ffmpeg_exit(1); } ost = new_output_stream(oc, file_idx); subtitle_enc = st->codec; output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); if(!subtitle_stream_copy){ if (subtitle_codec_name) { codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1, avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance); codec= output_codecs[nb_output_codecs-1] = avcodec_find_encoder_by_name(subtitle_codec_name); } else { codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_SUBTITLE); codec = avcodec_find_encoder(codec_id); } } avcodec_get_context_defaults3(st->codec, codec); ost->bitstream_filters = subtitle_bitstream_filters; subtitle_bitstream_filters= NULL; subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE; if(subtitle_codec_tag) subtitle_enc->codec_tag= subtitle_codec_tag; if (oc->oformat->flags & AVFMT_GLOBALHEADER) { subtitle_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->flags |= CODEC_FLAG_GLOBAL_HEADER; } if (subtitle_stream_copy) { st->stream_copy = 1; } else { subtitle_enc->codec_id = codec_id; set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec); } if (subtitle_language) { av_dict_set(&st->metadata, "language", subtitle_language, 0); av_freep(&subtitle_language); } subtitle_disable = 0; av_freep(&subtitle_codec_name); subtitle_stream_copy = 0; } ffmpeg.c:3675: error: Null Dereference pointer `st` last assigned on line 3669 could be null and is dereferenced at line 3675, column 20. ffmpeg.c:3661:1: start of procedure new_subtitle_stream() 3659. } 3660. 3661. static void new_subtitle_stream(AVFormatContext *oc, int file_idx) ^ 3662. { 3663. AVStream *st; ffmpeg.c:3665:5: 3663. AVStream *st; 3664. AVOutputStream *ost; 3665. AVCodec *codec=NULL; ^ 3666. AVCodecContext *subtitle_enc; 3667. enum CodecID codec_id = CODEC_ID_NONE; ffmpeg.c:3667:5: 3665. AVCodec *codec=NULL; 3666. AVCodecContext *subtitle_enc; 3667. enum CodecID codec_id = CODEC_ID_NONE; ^ 3668. 3669. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ffmpeg.c:3669:28: Condition is true 3667. enum CodecID codec_id = CODEC_ID_NONE; 3668. 3669. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3670. if (!st) { 3671. fprintf(stderr, "Could not alloc stream\n"); ffmpeg.c:3669:5: 3667. enum CodecID codec_id = CODEC_ID_NONE; 3668. 3669. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3670. if (!st) { 3671. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2582:1: start of procedure av_new_stream() 2580. } 2581. 2582. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2583. { 2584. AVStream *st; libavformat/utils.c:2588:9: Taking true branch 2586. AVStream **streams; 2587. 2588. if (s->nb_streams >= INT_MAX/sizeof(*streams)) ^ 2589. return NULL; 2590. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); libavformat/utils.c:2589:9: 2587. 2588. if (s->nb_streams >= INT_MAX/sizeof(*streams)) 2589. return NULL; ^ 2590. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); 2591. if (!streams) libavformat/utils.c:2631:1: return from a call to av_new_stream 2629. s->streams[s->nb_streams++] = st; 2630. return st; 2631. } ^ 2632. 2633. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:3670:10: Taking true branch 3668. 3669. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3670. if (!st) { ^ 3671. fprintf(stderr, "Could not alloc stream\n"); 3672. ffmpeg_exit(1); ffmpeg.c:3671:9: 3669. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3670. if (!st) { 3671. fprintf(stderr, "Could not alloc stream\n"); ^ 3672. ffmpeg_exit(1); 3673. } ffmpeg.c:3672:9: Skipping ffmpeg_exit(): empty list of specs 3670. if (!st) { 3671. fprintf(stderr, "Could not alloc stream\n"); 3672. ffmpeg_exit(1); ^ 3673. } 3674. ost = new_output_stream(oc, file_idx); ffmpeg.c:3674:5: Skipping new_output_stream(): empty list of specs 3672. ffmpeg_exit(1); 3673. } 3674. ost = new_output_stream(oc, file_idx); ^ 3675. subtitle_enc = st->codec; 3676. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); ffmpeg.c:3675:5: 3673. } 3674. ost = new_output_stream(oc, file_idx); 3675. subtitle_enc = st->codec; ^ 3676. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); 3677. if(!subtitle_stream_copy){
https://github.com/libav/libav/blob/a6286bda0956bfe15b4e1a9f96e1689666e1d866/ffmpeg.c/#L3675
d2a_code_trace_data_45864
char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) { const X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; if (num > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_IA5STRING) { if (num > (int)sizeof(ebcdic_buf)) num = sizeof(ebcdic_buf); ascii2ebcdic(ebcdic_buf, q, num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (l > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); end: BUF_MEM_free(b); return (NULL); } test/ssltest_old.c:2917: error: BUFFER_OVERRUN_L3 Offset added: [200, 256] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace test/ssltest_old.c:2917:9: Call 2915. char *s, buf[256]; 2916. 2917. s = X509_NAME_oneline(X509_get_subject_name(X509_STORE_CTX_get_current_cert(ctx)), ^ 2918. buf, sizeof buf); 2919. if (s != NULL) { crypto/x509/x509_obj.c:25:1: <Offset trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `len` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: <Length trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `*buf` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:56:9: Array access: Offset added: [200, 256] Size: [1, 2147483644] by call to `X509_NAME_oneline` 54. OPENSSL_free(b); 55. } 56. strncpy(buf, "NO X509_NAME", len); ^ 57. buf[len - 1] = '\0'; 58. return buf;
https://github.com/openssl/openssl/blob/cdb2a60347f988037d29adc7e4415e9c66c8a5a5/crypto/x509/x509_obj.c/#L56
d2a_code_trace_data_45865
int test_gf2m_mod_exp(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b[2], *c, *d, *e, *f; int i, j, ret = 0; int p0[] = { 163, 7, 6, 3, 0, -1 }; int p1[] = { 193, 15, 0, -1 }; a = BN_new(); b[0] = BN_new(); b[1] = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); f = BN_new(); BN_GF2m_arr2poly(p0, b[0]); BN_GF2m_arr2poly(p1, b[1]); for (i = 0; i < num0; i++) { BN_bntest_rand(a, 512, 0, 0); BN_bntest_rand(c, 512, 0, 0); BN_bntest_rand(d, 512, 0, 0); for (j = 0; j < 2; j++) { BN_GF2m_mod_exp(e, a, c, b[j], ctx); BN_GF2m_mod_exp(f, a, d, b[j], ctx); BN_GF2m_mod_mul(e, e, f, b[j], ctx); BN_add(f, c, d); BN_GF2m_mod_exp(f, a, f, b[j], ctx); BN_GF2m_add(f, e, f); if (!BN_is_zero(f)) { fprintf(stderr, "GF(2^m) modular exponentiation test failed!\n"); goto err; } } } ret = 1; err: BN_free(a); BN_free(b[0]); BN_free(b[1]); BN_free(c); BN_free(d); BN_free(e); BN_free(f); return ret; } test/bntest.c:1514: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1482, column 9 is not reachable after line 1514, column 5. Showing all 177 steps of the trace test/bntest.c:1475:1: start of procedure test_gf2m_mod_exp() 1473. } 1474. 1475. > int test_gf2m_mod_exp(BIO *bp, BN_CTX *ctx) 1476. { 1477. BIGNUM *a, *b[2], *c, *d, *e, *f; test/bntest.c:1478:5: 1476. { 1477. BIGNUM *a, *b[2], *c, *d, *e, *f; 1478. > int i, j, ret = 0; 1479. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1480. int p1[] = { 193, 15, 0, -1 }; test/bntest.c:1479:5: 1477. BIGNUM *a, *b[2], *c, *d, *e, *f; 1478. int i, j, ret = 0; 1479. > int p0[] = { 163, 7, 6, 3, 0, -1 }; 1480. int p1[] = { 193, 15, 0, -1 }; 1481. test/bntest.c:1480:5: 1478. int i, j, ret = 0; 1479. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1480. > int p1[] = { 193, 15, 0, -1 }; 1481. 1482. a = BN_new(); test/bntest.c:1482:5: 1480. int p1[] = { 193, 15, 0, -1 }; 1481. 1482. > a = BN_new(); 1483. b[0] = BN_new(); 1484. b[1] = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1483:5: 1481. 1482. a = BN_new(); 1483. > b[0] = BN_new(); 1484. b[1] = BN_new(); 1485. c = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1484:5: 1482. a = BN_new(); 1483. b[0] = BN_new(); 1484. > b[1] = BN_new(); 1485. c = BN_new(); 1486. d = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1485:5: 1483. b[0] = BN_new(); 1484. b[1] = BN_new(); 1485. > c = BN_new(); 1486. d = BN_new(); 1487. e = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1486:5: 1484. b[1] = BN_new(); 1485. c = BN_new(); 1486. > d = BN_new(); 1487. e = BN_new(); 1488. f = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1487:5: 1485. c = BN_new(); 1486. d = BN_new(); 1487. > e = BN_new(); 1488. f = BN_new(); 1489. crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1488:5: 1486. d = BN_new(); 1487. e = BN_new(); 1488. > f = BN_new(); 1489. 1490. BN_GF2m_arr2poly(p0, b[0]); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1490:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1488. f = BN_new(); 1489. 1490. BN_GF2m_arr2poly(p0, b[0]); ^ 1491. BN_GF2m_arr2poly(p1, b[1]); 1492. test/bntest.c:1491:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1489. 1490. BN_GF2m_arr2poly(p0, b[0]); 1491. BN_GF2m_arr2poly(p1, b[1]); ^ 1492. 1493. for (i = 0; i < num0; i++) { test/bntest.c:1493:10: 1491. BN_GF2m_arr2poly(p1, b[1]); 1492. 1493. > for (i = 0; i < num0; i++) { 1494. BN_bntest_rand(a, 512, 0, 0); 1495. BN_bntest_rand(c, 512, 0, 0); test/bntest.c:1493:17: Loop condition is false. Leaving loop 1491. BN_GF2m_arr2poly(p1, b[1]); 1492. 1493. for (i = 0; i < num0; i++) { ^ 1494. BN_bntest_rand(a, 512, 0, 0); 1495. BN_bntest_rand(c, 512, 0, 0); test/bntest.c:1512:5: 1510. } 1511. } 1512. > ret = 1; 1513. err: 1514. BN_free(a); test/bntest.c:1513:2: 1511. } 1512. ret = 1; 1513. > err: 1514. BN_free(a); 1515. BN_free(b[0]); test/bntest.c:1514:5: 1512. ret = 1; 1513. err: 1514. > BN_free(a); 1515. BN_free(b[0]); 1516. BN_free(b[1]); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L1514
d2a_code_trace_data_45866
YUV2RGBFUNC(yuva2rgba_c, uint32_t, 1) LOADCHROMA(0); PUTRGBA(dst_1, py_1, pa_1, 0, 24); PUTRGBA(dst_2, py_2, pa_2, 0, 24); LOADCHROMA(1); PUTRGBA(dst_2, py_2, pa_1, 1, 24); PUTRGBA(dst_1, py_1, pa_2, 1, 24); LOADCHROMA(2); PUTRGBA(dst_1, py_1, pa_1, 2, 24); PUTRGBA(dst_2, py_2, pa_2, 2, 24); LOADCHROMA(3); PUTRGBA(dst_2, py_2, pa_1, 3, 24); PUTRGBA(dst_1, py_1, pa_2, 3, 24); pa_1 += 8; \ pa_2 += 8; \ ENDYUV2RGBLINE(8) LOADCHROMA(0); PUTRGBA(dst_1, py_1, pa_1, 0, 24); PUTRGBA(dst_2, py_2, pa_2, 0, 24); LOADCHROMA(1); PUTRGBA(dst_2, py_2, pa_1, 1, 24); PUTRGBA(dst_1, py_1, pa_2, 1, 24); ENDYUV2RGBFUNC() libswscale/yuv2rgb.c:265: error: Uninitialized Value The value read from pa_1 was never initialized. libswscale/yuv2rgb.c:265:5: 263. PUTRGBA(dst_2, py_2, pa_1, 3, 24); 264. PUTRGBA(dst_1, py_1, pa_2, 3, 24); 265. pa_1 += 8; \ ^ 266. pa_2 += 8; \ 267. ENDYUV2RGBLINE(8)
https://github.com/libav/libav/blob/0ad522afb3a3b3d22402ecb82dd4609f7655031b/libswscale/yuv2rgb.c/#L265
d2a_code_trace_data_45867
char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) { X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_IA5STRING) { ascii2ebcdic(ebcdic_buf, q, (num > (int)sizeof(ebcdic_buf)) ? (int)sizeof(ebcdic_buf) : num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); BUF_MEM_free(b); return (NULL); } apps/apps.c:1239: error: BUFFER_OVERRUN_L3 Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace apps/apps.c:1239:15: Call 1237. } 1238. if (lflags == XN_FLAG_COMPAT) { 1239. buf = X509_NAME_oneline(nm, 0, 0); ^ 1240. BIO_puts(out, buf); 1241. BIO_puts(out, "\n"); crypto/x509/x509_obj.c:66:1: <Offset trace> 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: Parameter `len` 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: <Length trace> 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: Parameter `*buf` 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:97:9: Array access: Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline` 95. OPENSSL_free(b); 96. } 97. strncpy(buf, "NO X509_NAME", len); ^ 98. buf[len - 1] = '\0'; 99. return buf;
https://github.com/openssl/openssl/blob/b33d1141b6dcce947708b984c5e9e91dad3d675d/crypto/x509/x509_obj.c/#L97
d2a_code_trace_data_45868
static inline uint64_t get_val(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1); bc->bits >>= n; #else uint64_t ret = bc->bits >> (64 - n); bc->bits <<= n; #endif bc->bits_left -= n; return ret; } libavcodec/alsdec.c:1131: error: Integer Overflow L2 ([-2, +oo] - 1):unsigned32 by call to `read_decode_block`. libavcodec/alsdec.c:1082:1: Parameter `ctx->bc.bits_left` 1080. /** Decode blocks dependently. 1081. */ 1082. static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame, ^ 1083. unsigned int c, const unsigned int *div_blocks, 1084. unsigned int *js_blocks) libavcodec/alsdec.c:1131:20: Call 1129. bd[1].raw_other = bd[0].raw_samples; 1130. 1131. if ((ret = read_decode_block(ctx, &bd[0])) < 0 || ^ 1132. (ret = read_decode_block(ctx, &bd[1])) < 0) 1133. goto fail; libavcodec/alsdec.c:1013:1: Parameter `ctx->bc.bits_left` 1011. /** Read and decode block data successively. 1012. */ 1013. static int read_decode_block(ALSDecContext *ctx, ALSBlockData *bd) ^ 1014. { 1015. int ret; libavcodec/alsdec.c:1017:16: Call 1015. int ret; 1016. 1017. if ((ret = read_block(ctx, bd)) < 0) ^ 1018. return ret; 1019. libavcodec/alsdec.c:968:1: Parameter `ctx->bc.bits_left` 966. /** Read the block data. 967. */ 968. static int read_block(ALSDecContext *ctx, ALSBlockData *bd) ^ 969. { 970. int ret = 0; libavcodec/alsdec.c:975:9: Call 973. *bd->shift_lsbs = 0; 974. // read block type flag and read the samples accordingly 975. if (bitstream_read_bit(bc)) { ^ 976. ret = read_var_block_data(ctx, bd); 977. } else { libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Assignment 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret; libavcodec/alsdec.c:976:15: Call 974. // read block type flag and read the samples accordingly 975. if (bitstream_read_bit(bc)) { 976. ret = read_var_block_data(ctx, bd); ^ 977. } else { 978. read_const_block_data(ctx, bd); libavcodec/alsdec.c:596:1: Parameter `ctx->bc.bits_left` 594. /** Read the block data for a non-constant block 595. */ 596. static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd) ^ 597. { 598. ALSSpecificConfig *sconf = &ctx->sconf; libavcodec/alsdec.c:616:23: Call 614. 615. *bd->opt_order = 1; 616. bd->js_blocks = bitstream_read_bit(bc); ^ 617. 618. opt_order = *bd->opt_order; libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Assignment 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret; libavcodec/alsdec.c:627:35: Call 625. log2_sub_blocks = bitstream_read(bc, 2); 626. else 627. log2_sub_blocks = 2 * bitstream_read_bit(bc); ^ 628. } 629. libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([-2, +oo] - 1):unsigned32 by call to `read_decode_block` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/7ff018c1cb43a5fe5ee2049d325cdd785852067a/libavcodec/bitstream.h/#L139
d2a_code_trace_data_45869
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } test/bntest.c:237: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bntest_rand`. Showing all 18 steps of the trace test/bntest.c:238:24: Call 236. if (i < NUM1) { 237. if (!(TEST_true(BN_bntest_rand(a, 512, 0, 0))) 238. && TEST_ptr(BN_copy(b, a)) ^ 239. && TEST_int_ne(BN_set_bit(a, i), 0) 240. && TEST_true(BN_add_word(b, i))) crypto/bn/bn_lib.c:281:1: Parameter `a->top` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); test/bntest.c:237:19: Call 235. for (i = 0; i < NUM0 + NUM1; i++) { 236. if (i < NUM1) { 237. if (!(TEST_true(BN_bntest_rand(a, 512, 0, 0))) ^ 238. && TEST_ptr(BN_copy(b, a)) 239. && TEST_int_ne(BN_set_bit(a, i), 0) crypto/bn/bn_rand.c:111:1: Parameter `*rnd->d` 109. } 110. 111. > int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom) 112. { 113. return bnrand(TESTING, rnd, bits, top, bottom, NULL); crypto/bn/bn_rand.c:113:12: Call 111. int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom) 112. { 113. return bnrand(TESTING, rnd, bits, top, bottom, NULL); ^ 114. } 115. crypto/bn/bn_rand.c:23:1: Parameter `*rnd->d` 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_rand.c:33:9: Call 31. if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) 32. goto toosmall; 33. BN_zero(rnd); ^ 34. return 1; 35. } crypto/bn/bn_lib.c:361:1: Parameter `*a->d` 359. } 360. 361. > int BN_set_word(BIGNUM *a, BN_ULONG w) 362. { 363. bn_check_top(a); crypto/bn/bn_lib.c:364:9: Call 362. { 363. bn_check_top(a); 364. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 365. return 0; 366. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `*a->d` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:668:12: Call 666. return a; 667. 668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 669. } 670. crypto/bn/bn_lib.c:245:1: Parameter `*b->d` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `*b->d` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bntest_rand` 230. assert(b->top <= words); 231. if (b->top > 0) 232. memcpy(a, b->d, sizeof(*a) * b->top); ^ 233. 234. return a;
https://github.com/openssl/openssl/blob/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_45870
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } crypto/ec/ecdsa_ossl.c:257: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_mod_mul_montgomery`. Showing all 19 steps of the trace crypto/ec/ecdsa_ossl.c:212:10: Call 210. if (8 * dgst_len > i) 211. dgst_len = (i + 7) / 8; 212. if (!BN_bin2bn(dgst, dgst_len, m)) { ^ 213. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); 214. goto err; crypto/bn/bn_lib.c:372:1: Parameter `ret->top` 370. } 371. 372. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 373. { 374. unsigned int i, m; crypto/ec/ecdsa_ossl.c:257:17: Call 255. */ 256. if (!bn_to_mont_fixed_top(s, s, group->mont_data, ctx) 257. || !BN_mod_mul_montgomery(s, s, ckinv, group->mont_data, ctx)) { ^ 258. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); 259. goto err; crypto/bn/bn_mont.c:26:1: Parameter `a->top` 24. #endif 25. 26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { crypto/bn/bn_mont.c:29:15: Call 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { 29. int ret = bn_mul_mont_fixed_top(r, a, b, mont, ctx); ^ 30. 31. bn_correct_top(r); crypto/bn/bn_mont.c:37:1: Parameter `b->top` 35. } 36. 37. > int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 38. BN_MONT_CTX *mont, BN_CTX *ctx) 39. { crypto/bn/bn_mont.c:67:14: Call 65. bn_check_top(tmp); 66. if (a == b) { 67. if (!BN_sqr(tmp, a, ctx)) ^ 68. goto err; 69. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:99:1: <Offset trace> 97. 98. /* tmp must have 2*n words */ 99. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 100. { 101. int i, j, max; crypto/bn/bn_sqr.c:99:1: Parameter `n` 97. 98. /* tmp must have 2*n words */ 99. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 100. { 101. int i, j, max; crypto/bn/bn_sqr.c:110:5: Assignment 108. rp[0] = rp[max - 1] = 0; 109. rp++; 110. j = n; ^ 111. 112. if (--j > 0) { crypto/bn/bn_sqr.c:112:9: Assignment 110. j = n; 111. 112. if (--j > 0) { ^ 113. ap++; 114. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:99:1: <Length trace> 97. 98. /* tmp must have 2*n words */ 99. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 100. { 101. int i, j, max; crypto/bn/bn_sqr.c:99:1: Parameter `*r` 97. 98. /* tmp must have 2*n words */ 99. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 100. { 101. int i, j, max; crypto/bn/bn_sqr.c:107:5: Assignment 105. max = n * 2; 106. ap = a; 107. rp = r; ^ 108. rp[0] = rp[max - 1] = 0; 109. rp++; crypto/bn/bn_sqr.c:109:5: Assignment 107. rp = r; 108. rp[0] = rp[max - 1] = 0; 109. rp++; ^ 110. j = n; 111. crypto/bn/bn_sqr.c:114:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_mod_mul_montgomery` 112. if (--j > 0) { 113. ap++; 114. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 115. rp += 2; 116. }
https://github.com/openssl/openssl/blob/4cc968df403ed9321d0df722aba33323ae575ce0/crypto/bn/bn_sqr.c/#L114
d2a_code_trace_data_45871
static int vorbis_parse_audio_packet(vorbis_context *vc) { GetBitContext *gb=&vc->gb; uint_fast8_t previous_window=0,next_window=0; uint_fast8_t mode_number; uint_fast16_t blocksize; int_fast32_t i,j; uint_fast8_t no_residue[vc->audio_channels]; uint_fast8_t do_not_decode[vc->audio_channels]; vorbis_mapping *mapping; float *ch_res_ptr=vc->channel_residues; float *ch_floor_ptr=vc->channel_floors; uint_fast8_t res_chan[vc->audio_channels]; uint_fast8_t res_num=0; int_fast16_t retlen=0; uint_fast16_t saved_start=0; float fadd_bias = vc->add_bias; if (get_bits1(gb)) { av_log(vc->avccontext, AV_LOG_ERROR, "Not a Vorbis I audio packet.\n"); return -1; } if (vc->mode_count==1) { mode_number=0; } else { mode_number=get_bits(gb, ilog(vc->mode_count-1)); } vc->mode_number=mode_number; mapping=&vc->mappings[vc->modes[mode_number].mapping]; AV_DEBUG(" Mode number: %d , mapping: %d , blocktype %d \n", mode_number, vc->modes[mode_number].mapping, vc->modes[mode_number].blockflag); if (vc->modes[mode_number].blockflag) { previous_window=get_bits1(gb); next_window=get_bits1(gb); } blocksize=vc->blocksize[vc->modes[mode_number].blockflag]; memset(ch_res_ptr, 0, sizeof(float)*vc->audio_channels*blocksize/2); memset(ch_floor_ptr, 0, sizeof(float)*vc->audio_channels*blocksize/2); for(i=0;i<vc->audio_channels;++i) { vorbis_floor *floor; if (mapping->submaps>1) { floor=&vc->floors[mapping->submap_floor[mapping->mux[i]]]; } else { floor=&vc->floors[mapping->submap_floor[0]]; } no_residue[i]=floor->decode(vc, &floor->data, ch_floor_ptr); ch_floor_ptr+=blocksize/2; } for(i=mapping->coupling_steps-1;i>=0;--i) { if (!(no_residue[mapping->magnitude[i]] & no_residue[mapping->angle[i]])) { no_residue[mapping->magnitude[i]]=0; no_residue[mapping->angle[i]]=0; } } for(i=0;i<mapping->submaps;++i) { vorbis_residue *residue; uint_fast8_t ch=0; for(j=0;j<vc->audio_channels;++j) { if ((mapping->submaps==1) || (i=mapping->mux[j])) { res_chan[j]=res_num; if (no_residue[j]) { do_not_decode[ch]=1; } else { do_not_decode[ch]=0; } ++ch; ++res_num; } } residue=&vc->residues[mapping->submap_residue[i]]; vorbis_residue_decode(vc, residue, ch, do_not_decode, ch_res_ptr, blocksize/2); ch_res_ptr+=ch*blocksize/2; } for(i=mapping->coupling_steps-1;i>=0;--i) { float *mag, *ang; mag=vc->channel_residues+res_chan[mapping->magnitude[i]]*blocksize/2; ang=vc->channel_residues+res_chan[mapping->angle[i]]*blocksize/2; vc->dsp.vorbis_inverse_coupling(mag, ang, blocksize/2); } for(j=0, ch_floor_ptr=vc->channel_floors;j<vc->audio_channels;++j,ch_floor_ptr+=blocksize/2) { ch_res_ptr=vc->channel_residues+res_chan[j]*blocksize/2; vc->dsp.vector_fmul(ch_floor_ptr, ch_res_ptr, blocksize/2); } for(j=0;j<vc->audio_channels;++j) { uint_fast8_t step=vc->audio_channels; uint_fast16_t k; float *saved=vc->saved+j*vc->blocksize[1]/2; float *ret=vc->ret; const float *lwin=vc->win[1]; const float *swin=vc->win[0]; float *buf=vc->buf; float *buf_tmp=vc->buf_tmp; ch_floor_ptr=vc->channel_floors+j*blocksize/2; saved_start=vc->saved_start; vc->mdct[0].fft.imdct_calc(&vc->mdct[vc->modes[mode_number].blockflag], buf, ch_floor_ptr, buf_tmp); if (vc->modes[mode_number].blockflag) { if (previous_window) { vc->dsp.vector_fmul_add_add(ret+j, buf, lwin, saved, vc->add_bias, vc->blocksize[1]/2, step); retlen=vc->blocksize[1]/2; } else { int len = (vc->blocksize[1]-vc->blocksize[0])/4; buf += len; vc->dsp.vector_fmul_add_add(ret+j, buf, swin, saved, vc->add_bias, vc->blocksize[0]/2, step); k = vc->blocksize[0]/2*step + j; buf += vc->blocksize[0]/2; if(vc->exp_bias){ for(i=0; i<len; i++, k+=step) ((uint32_t*)ret)[k] = ((uint32_t*)buf)[i] + vc->exp_bias; } else { for(i=0; i<len; i++, k+=step) ret[k] = buf[i] + fadd_bias; } buf=vc->buf; retlen=vc->blocksize[0]/2+len; } if (next_window) { buf += vc->blocksize[1]/2; vc->dsp.vector_fmul_reverse(saved, buf, lwin, vc->blocksize[1]/2); saved_start=0; } else { saved_start=(vc->blocksize[1]-vc->blocksize[0])/4; buf += vc->blocksize[1]/2; for(i=0; i<saved_start; i++) ((uint32_t*)saved)[i] = ((uint32_t*)buf)[i] + vc->exp_bias; vc->dsp.vector_fmul_reverse(saved+saved_start, buf+saved_start, swin, vc->blocksize[0]/2); } } else { if(vc->add_bias) { for(k=j, i=0;i<saved_start;++i, k+=step) ret[k] = saved[i] + fadd_bias; } else { for(k=j, i=0;i<saved_start;++i, k+=step) ret[k] = saved[i]; } vc->dsp.vector_fmul_add_add(ret+k, buf, swin, saved+saved_start, vc->add_bias, vc->blocksize[0]/2, step); retlen=saved_start+vc->blocksize[0]/2; buf += vc->blocksize[0]/2; vc->dsp.vector_fmul_reverse(saved, buf, swin, vc->blocksize[0]/2); saved_start=0; } } vc->saved_start=saved_start; return retlen*vc->audio_channels; } libavcodec/vorbis_dec.c:1597: error: Integer Overflow L2 ([0, +oo] - 1):unsigned64 by call to `vorbis_parse_audio_packet`. libavcodec/vorbis_dec.c:1597:9: Call 1595. init_get_bits(gb, buf, buf_size*8); 1596. 1597. len=vorbis_parse_audio_packet(vc); ^ 1598. 1599. if (len<=0) { libavcodec/vorbis_dec.c:1398:1: <LHS trace> 1396. // Decode the audio packet using the functions above 1397. 1398. static int vorbis_parse_audio_packet(vorbis_context *vc) { ^ 1399. GetBitContext *gb=&vc->gb; 1400. libavcodec/vorbis_dec.c:1398:1: Parameter `vc->mappings->coupling_steps` 1396. // Decode the audio packet using the functions above 1397. 1398. static int vorbis_parse_audio_packet(vorbis_context *vc) { ^ 1399. GetBitContext *gb=&vc->gb; 1400. libavcodec/vorbis_dec.c:1456:9: Binary operation: ([0, +oo] - 1):unsigned64 by call to `vorbis_parse_audio_packet` 1454. // Nonzero vector propagate 1455. 1456. for(i=mapping->coupling_steps-1;i>=0;--i) { ^ 1457. if (!(no_residue[mapping->magnitude[i]] & no_residue[mapping->angle[i]])) { 1458. no_residue[mapping->magnitude[i]]=0;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vorbis_dec.c/#L1456
d2a_code_trace_data_45872
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) { bn_check_top(b); if (a == b) return a; if (bn_wexpand(a, b->top) == NULL) return NULL; if (b->top > 0) memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); a->neg = b->neg; a->top = b->top; a->flags |= b->flags & BN_FLG_FIXED_TOP; bn_check_top(a); return a; } ssl/tls_srp.c:259: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `SRP_Calc_server_key`. Showing all 30 steps of the trace ssl/tls_srp.c:249:1: Parameter `s->srp_ctx.N->top` 247. } 248. 249. > int srp_generate_server_master_secret(SSL *s) 250. { 251. BIGNUM *K = NULL, *u = NULL; ssl/tls_srp.c:255:10: Call 253. unsigned char *tmp = NULL; 254. 255. if (!SRP_Verify_A_mod_N(s->srp_ctx.A, s->srp_ctx.N)) ^ 256. goto err; 257. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL) crypto/srp/srp_lib.c:239:1: Parameter `N->top` 237. } 238. 239. > int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N) 240. { 241. /* Checks if A % N == 0 */ crypto/srp/srp_lib.c:242:12: Call 240. { 241. /* Checks if A % N == 0 */ 242. return SRP_Verify_B_mod_N(A, N); ^ 243. } 244. crypto/srp/srp_lib.c:218:1: Parameter `N->top` 216. } 217. 218. > int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N) 219. { 220. BIGNUM *r; ssl/tls_srp.c:257:14: Call 255. if (!SRP_Verify_A_mod_N(s->srp_ctx.A, s->srp_ctx.N)) 256. goto err; 257. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL) ^ 258. goto err; 259. if ((K = SRP_Calc_server_key(s->srp_ctx.A, s->srp_ctx.v, u, s->srp_ctx.b, crypto/srp/srp_lib.c:52:1: Parameter `N->top` 50. } 51. 52. > BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N) 53. { 54. /* u = SHA1(PAD(A) || PAD(B) ) -- tls-srp RFC 5054 */ crypto/srp/srp_lib.c:55:12: Call 53. { 54. /* u = SHA1(PAD(A) || PAD(B) ) -- tls-srp RFC 5054 */ 55. return srp_Calc_xy(A, B, N); ^ 56. } 57. crypto/srp/srp_lib.c:23:1: Parameter `N->top` 21. /* calculate = SHA1(PAD(x) || PAD(y)) */ 22. 23. > static BIGNUM *srp_Calc_xy(const BIGNUM *x, const BIGNUM *y, const BIGNUM *N) 24. { 25. unsigned char digest[SHA_DIGEST_LENGTH]; crypto/srp/srp_lib.c:27:16: Call 25. unsigned char digest[SHA_DIGEST_LENGTH]; 26. unsigned char *tmp = NULL; 27. int numN = BN_num_bytes(N); ^ 28. BIGNUM *res = NULL; 29. crypto/bn/bn_lib.c:140:9: Call 138. bn_check_top(a); 139. 140. if (BN_is_zero(a)) ^ 141. return 0; 142. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); crypto/bn/bn_lib.c:843:1: Parameter `a->top` 841. } 842. 843. > int BN_is_zero(const BIGNUM *a) 844. { 845. return a->top == 0; ssl/tls_srp.c:259:14: Call 257. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL) 258. goto err; 259. if ((K = SRP_Calc_server_key(s->srp_ctx.A, s->srp_ctx.v, u, s->srp_ctx.b, ^ 260. s->srp_ctx.N)) == NULL) 261. goto err; crypto/srp/srp_lib.c:58:1: Parameter `N->top` 56. } 57. 58. > BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u, 59. const BIGNUM *b, const BIGNUM *N) 60. { crypto/srp/srp_lib.c:72:10: Call 70. /* S = (A*v**u) ** b */ 71. 72. if (!BN_mod_exp(tmp, v, u, N, bn_ctx)) ^ 73. goto err; 74. if (!BN_mod_mul(tmp, A, tmp, N, bn_ctx)) crypto/bn/bn_exp.c:89:1: Parameter `m->top` 87. } 88. 89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 90. BN_CTX *ctx) 91. { crypto/bn/bn_exp.c:134:9: Call 132. 133. #ifdef MONT_MUL_MOD 134. if (BN_is_odd(m)) { ^ 135. # ifdef MONT_EXP_WORD 136. if (a->top == 1 && !a->neg crypto/bn/bn_lib.c:858:1: Parameter `a->top` 856. } 857. 858. > int BN_is_odd(const BIGNUM *a) 859. { 860. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_exp.c:149:15: Call 147. #ifdef RECP_MUL_MOD 148. { 149. ret = BN_mod_exp_recp(r, a, p, m, ctx); ^ 150. } 151. #else crypto/bn/bn_exp.c:161:1: Parameter `m->top` 159. } 160. 161. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 162. const BIGNUM *m, BN_CTX *ctx) 163. { crypto/bn/bn_exp.c:206:13: Call 204. goto err; 205. } else { 206. if (BN_RECP_CTX_set(&recp, m, ctx) <= 0) ^ 207. goto err; 208. } crypto/bn/bn_recp.c:45:1: Parameter `d->top` 43. } 44. 45. > int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx) 46. { 47. if (!BN_copy(&(recp->N), d)) crypto/bn/bn_recp.c:47:10: Call 45. int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx) 46. { 47. if (!BN_copy(&(recp->N), d)) ^ 48. return 0; 49. BN_zero(&(recp->Nr)); crypto/bn/bn_lib.c:281:1: <Offset trace> 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: Parameter `b->top` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: <Length trace> 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: Parameter `*a->d` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:287:9: Call 285. if (a == b) 286. return a; 287. if (bn_wexpand(a, b->top) == NULL) ^ 288. return NULL; 289. crypto/bn/bn_lib.c:939:1: Parameter `*a->d` 937. } 938. 939. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 940. { 941. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:291:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `SRP_Calc_server_key` 289. 290. if (b->top > 0) 291. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 292. 293. a->neg = b->neg;
https://github.com/openssl/openssl/blob/ea09abc80892920ee5db4de82bed7a193b5896f0/crypto/bn/bn_lib.c/#L291
d2a_code_trace_data_45873
int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt) { int i, j, t, rconpointer = 0; uint8_t tk[8][4]; int KC= key_bits>>5; int rounds= KC + 6; uint8_t log8[256]; uint8_t alog8[512]; if(!enc_multbl[0][sizeof(enc_multbl)/sizeof(enc_multbl[0][0])-1]){ j=1; for(i=0; i<255; i++){ alog8[i]= alog8[i+255]= j; log8[j]= i; j^= j+j; if(j>255) j^= 0x11B; } for(i=0; i<256; i++){ j= i ? alog8[255-log8[i]] : 0; j ^= (j<<1) ^ (j<<2) ^ (j<<3) ^ (j<<4); j = (j ^ (j>>8) ^ 99) & 255; inv_sbox[j]= i; sbox [i]= j; } init_multbl2(dec_multbl[0], (int[4]){0xe, 0x9, 0xd, 0xb}, log8, alog8, inv_sbox); init_multbl2(enc_multbl[0], (int[4]){0x2, 0x1, 0x1, 0x3}, log8, alog8, sbox); } if(key_bits!=128 && key_bits!=192 && key_bits!=256) return -1; a->rounds= rounds; memcpy(tk, key, KC*4); for(t= 0; t < (rounds+1)*16;) { memcpy(a->round_key[0][0]+t, tk, KC*4); t+= KC*4; for(i = 0; i < 4; i++) tk[0][i] ^= sbox[tk[KC-1][(i+1)&3]]; tk[0][0] ^= rcon[rconpointer++]; for(j = 1; j < KC; j++){ if(KC != 8 || j != KC>>1) for(i = 0; i < 4; i++) tk[j][i] ^= tk[j-1][i]; else for(i = 0; i < 4; i++) tk[j][i] ^= sbox[tk[j-1][i]]; } } if(decrypt){ for(i=1; i<rounds; i++){ uint8_t tmp[3][16]; memcpy(tmp[2], a->round_key[i][0], 16); subshift(tmp[1], 0, sbox); mix(tmp, dec_multbl, 1, 3); memcpy(a->round_key[i][0], tmp[0], 16); } }else{ for(i=0; i<(rounds+1)>>1; i++){ for(j=0; j<16; j++) FFSWAP(int, a->round_key[i][0][j], a->round_key[rounds-i][0][j]); } } return 0; } libavutil/aes.c:179: error: Buffer Overrun L1 Offset added: 16 Size: 4. libavutil/aes.c:125:1: <Length trace> 123. 124. // this is based on the reference AES code by Paulo Barreto and Vincent Rijmen 125. int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt) { ^ 126. int i, j, t, rconpointer = 0; 127. uint8_t tk[8][4]; libavutil/aes.c:125:1: Array declaration 123. 124. // this is based on the reference AES code by Paulo Barreto and Vincent Rijmen 125. int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt) { ^ 126. int i, j, t, rconpointer = 0; 127. uint8_t tk[8][4]; libavutil/aes.c:179:13: Array access: Offset added: 16 Size: 4 177. for(i=1; i<rounds; i++){ 178. uint8_t tmp[3][16]; 179. memcpy(tmp[2], a->round_key[i][0], 16); ^ 180. subshift(tmp[1], 0, sbox); 181. mix(tmp, dec_multbl, 1, 3);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavutil/aes.c/#L179
d2a_code_trace_data_45874
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dsa/dsa_ossl.c:426: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`. Showing all 10 steps of the trace crypto/dsa/dsa_ossl.c:418:5: Call 416. return NULL; 417. 418. BN_CTX_start(ctx); ^ 419. if ((e = BN_CTX_get(ctx)) != NULL 420. && BN_set_word(r, 2) crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/dsa/dsa_ossl.c:426:5: Call 424. else 425. BN_free(r); 426. BN_CTX_end(ctx); ^ 427. return res; 428. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_45875
static int on2avc_decode_subframe(On2AVCContext *c, const uint8_t *buf, int buf_size, AVFrame *dst, int offset) { GetBitContext gb; int i, ret; init_get_bits(&gb, buf, buf_size * 8); if (get_bits1(&gb)) { av_log(c->avctx, AV_LOG_ERROR, "enh bit set\n"); return AVERROR_INVALIDDATA; } c->prev_window_type = c->window_type; c->window_type = get_bits(&gb, 3); if (c->window_type >= WINDOW_TYPE_EXT4 && c->avctx->channels == 1) { av_log(c->avctx, AV_LOG_ERROR, "stereo mode window for mono audio\n"); return AVERROR_INVALIDDATA; } c->band_start = c->modes[c->window_type].band_start; c->num_windows = c->modes[c->window_type].num_windows; c->num_bands = c->modes[c->window_type].num_bands; c->is_long = (c->window_type != WINDOW_TYPE_8SHORT); c->grouping[0] = 1; for (i = 1; i < c->num_windows; i++) c->grouping[i] = !get_bits1(&gb); on2avc_read_ms_info(c, &gb); for (i = 0; i < c->avctx->channels; i++) if ((ret = on2avc_read_channel_data(c, &gb, i)) < 0) return AVERROR_INVALIDDATA; if (c->avctx->channels == 2 && c->ms_present) on2avc_apply_ms(c); if (c->window_type < WINDOW_TYPE_EXT4) { for (i = 0; i < c->avctx->channels; i++) on2avc_reconstruct_channel(c, i, dst, offset); } else { on2avc_reconstruct_stereo(c, dst, offset); } return 0; } libavcodec/on2avc.c:800: error: Null Dereference pointer `&gb->buffer` last assigned on line 799 could be null and is dereferenced by call to `get_bits1()` at line 800, column 9. libavcodec/on2avc.c:793:1: start of procedure on2avc_decode_subframe() 791. } 792. 793. static int on2avc_decode_subframe(On2AVCContext *c, const uint8_t *buf, ^ 794. int buf_size, AVFrame *dst, int offset) 795. { libavcodec/on2avc.c:799:5: 797. int i, ret; 798. 799. init_get_bits(&gb, buf, buf_size * 8); ^ 800. if (get_bits1(&gb)) { 801. av_log(c->avctx, AV_LOG_ERROR, "enh bit set\n"); libavcodec/get_bits.h:375:1: start of procedure init_get_bits() 373. * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow. 374. */ 375. static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, ^ 376. int bit_size) 377. { libavcodec/get_bits.h:379:5: 377. { 378. int buffer_size; 379. int ret = 0; ^ 380. 381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { libavcodec/get_bits.h:381:9: Taking true branch 379. int ret = 0; 380. 381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { ^ 382. buffer_size = bit_size = 0; 383. buffer = NULL; libavcodec/get_bits.h:382:9: 380. 381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { 382. buffer_size = bit_size = 0; ^ 383. buffer = NULL; 384. ret = AVERROR_INVALIDDATA; libavcodec/get_bits.h:383:9: 381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { 382. buffer_size = bit_size = 0; 383. buffer = NULL; ^ 384. ret = AVERROR_INVALIDDATA; 385. } libavcodec/get_bits.h:384:9: 382. buffer_size = bit_size = 0; 383. buffer = NULL; 384. ret = AVERROR_INVALIDDATA; ^ 385. } 386. libavcodec/get_bits.h:387:5: 385. } 386. 387. buffer_size = (bit_size + 7) >> 3; ^ 388. 389. s->buffer = buffer; libavcodec/get_bits.h:389:5: 387. buffer_size = (bit_size + 7) >> 3; 388. 389. s->buffer = buffer; ^ 390. s->size_in_bits = bit_size; 391. #if !UNCHECKED_BITSTREAM_READER libavcodec/get_bits.h:390:5: 388. 389. s->buffer = buffer; 390. s->size_in_bits = bit_size; ^ 391. #if !UNCHECKED_BITSTREAM_READER 392. s->size_in_bits_plus8 = bit_size + 8; libavcodec/get_bits.h:392:5: 390. s->size_in_bits = bit_size; 391. #if !UNCHECKED_BITSTREAM_READER 392. s->size_in_bits_plus8 = bit_size + 8; ^ 393. #endif 394. s->buffer_end = buffer + buffer_size; libavcodec/get_bits.h:394:5: 392. s->size_in_bits_plus8 = bit_size + 8; 393. #endif 394. s->buffer_end = buffer + buffer_size; ^ 395. s->index = 0; 396. libavcodec/get_bits.h:395:5: 393. #endif 394. s->buffer_end = buffer + buffer_size; 395. s->index = 0; ^ 396. 397. return ret; libavcodec/get_bits.h:397:5: 395. s->index = 0; 396. 397. return ret; ^ 398. } 399. libavcodec/get_bits.h:398:1: return from a call to init_get_bits 396. 397. return ret; 398. } ^ 399. 400. /** libavcodec/on2avc.c:800:9: 798. 799. init_get_bits(&gb, buf, buf_size * 8); 800. if (get_bits1(&gb)) { ^ 801. av_log(c->avctx, AV_LOG_ERROR, "enh bit set\n"); 802. return AVERROR_INVALIDDATA; libavcodec/get_bits.h:271:1: start of procedure get_bits1() 269. } 270. 271. static inline unsigned int get_bits1(GetBitContext *s) ^ 272. { 273. unsigned int index = s->index; libavcodec/get_bits.h:273:5: 271. static inline unsigned int get_bits1(GetBitContext *s) 272. { 273. unsigned int index = s->index; ^ 274. uint8_t result = s->buffer[index >> 3]; 275. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:274:5: 272. { 273. unsigned int index = s->index; 274. uint8_t result = s->buffer[index >> 3]; ^ 275. #ifdef BITSTREAM_READER_LE 276. result >>= index & 7;
https://github.com/libav/libav/blob/1eb57e1d9b59db0aa63348c21bf3290bd3f5efcb/libavcodec/on2avc.c/#L800
d2a_code_trace_data_45876
char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) { X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; if (num > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_IA5STRING) { ascii2ebcdic(ebcdic_buf, q, (num > (int)sizeof(ebcdic_buf)) ? (int)sizeof(ebcdic_buf) : num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (l > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); end: BUF_MEM_free(b); return (NULL); } apps/x509.c:762: error: BUFFER_OVERRUN_L2 Offset: [-oo, 1048576] Size: 256 by call to `X509_NAME_oneline`. Showing all 8 steps of the trace apps/x509.c:193:1: Array declaration 191. }; 192. 193. > int x509_main(int argc, char **argv) 194. { 195. ASN1_INTEGER *sno = NULL; apps/x509.c:762:17: Call 760. int len; 761. 762. X509_NAME_oneline(X509_get_subject_name(x), buf, sizeof buf); ^ 763. BIO_printf(out, "/*\n" 764. " * Subject: %s\n", buf); crypto/x509/x509_obj.c:110:5: <Offset trace> 108. 109. len--; /* space for '\0' */ 110. l = 0; ^ 111. for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { 112. ne = sk_X509_NAME_ENTRY_value(a->entries, i); crypto/x509/x509_obj.c:110:5: Assignment 108. 109. len--; /* space for '\0' */ 110. l = 0; ^ 111. for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { 112. ne = sk_X509_NAME_ENTRY_value(a->entries, i); crypto/x509/x509_obj.c:168:9: Assignment 166. } 167. 168. lold = l; ^ 169. l += 1 + l1 + 1 + l2; 170. if (l > NAME_ONELINE_MAX) { crypto/x509/x509_obj.c:73:1: <Length trace> 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: Parameter `*buf` 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:181:13: Array access: Offset: [-oo, 1048576] Size: 256 by call to `X509_NAME_oneline` 179. break; 180. } else 181. p = &(buf[lold]); ^ 182. *(p++) = '/'; 183. memcpy(p, s, (unsigned int)l1);
https://github.com/openssl/openssl/blob/24c2cd3967ed23acc0bd31a3781c4525e2e42a2c/crypto/x509/x509_obj.c/#L181
d2a_code_trace_data_45877
static inline uint64_t get_val(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1); bc->bits >>= n; #else uint64_t ret = bc->bits >> (64 - n); bc->bits <<= n; #endif bc->bits_left -= n; return ret; } libavcodec/wavpack.c:628: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `wv_get_value_float`. libavcodec/wavpack.c:530:1: Parameter `s->bc_extra_bits.bits_left` 528. } 529. 530. static inline int wv_unpack_stereo(WavpackFrameContext *s, BitstreamContext *bc, ^ 531. void *dst_l, void *dst_r, const int type) 532. { libavcodec/wavpack.c:628:26: Call 626. 627. if (type == AV_SAMPLE_FMT_FLTP) { 628. *dstfl_l++ = wv_get_value_float(s, &crc_extra_bits, L); ^ 629. *dstfl_r++ = wv_get_value_float(s, &crc_extra_bits, R); 630. } else if (type == AV_SAMPLE_FMT_S32P) { libavcodec/wavpack.c:435:1: Parameter `s->bc_extra_bits.bits_left` 433. } 434. 435. static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S) ^ 436. { 437. union { libavcodec/wavpack.c:459:38: Call 457. S = -S; 458. if (S >= 0x1000000) { 459. if (s->got_extra_bits && bitstream_read_bit(&s->bc_extra_bits)) ^ 460. S = bitstream_read(&s->bc_extra_bits, 23); 461. else libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `wv_get_value_float` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139
d2a_code_trace_data_45878
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; bn_check_top(b); if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return (NULL); } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return (NULL); } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } test/bntest.c:1924: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_exp`. Showing all 19 steps of the trace test/bntest.c:1922:5: Call 1920. || !TEST_ptr(r = BN_new())) 1921. goto err; 1922. BN_zero(zero); ^ 1923. 1924. if (!TEST_true(BN_mod_exp(r, a, zero, BN_value_one(), NULL)) crypto/bn/bn_lib.c:402:15: Assignment 400. a->neg = 0; 401. a->d[0] = w; 402. a->top = (w ? 1 : 0); ^ 403. bn_check_top(a); 404. return (1); crypto/bn/bn_lib.c:402:5: Assignment 400. a->neg = 0; 401. a->d[0] = w; 402. a->top = (w ? 1 : 0); ^ 403. bn_check_top(a); 404. return (1); test/bntest.c:1924:10: Call 1922. BN_zero(zero); 1923. 1924. if (!TEST_true(BN_mod_exp(r, a, zero, BN_value_one(), NULL)) ^ 1925. || !TEST_BN_eq_zero(r) 1926. || !TEST_true(BN_mod_exp_mont(r, a, zero, BN_value_one(), crypto/bn/bn_exp.c:91:1: Parameter `*r->d` 89. } 90. 91. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 92. BN_CTX *ctx) 93. { crypto/bn/bn_exp.c:141:19: Call 139. && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0)) { 140. BN_ULONG A = a->d[0]; 141. ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL); ^ 142. } else 143. # endif crypto/bn/bn_exp.c:1091:1: Parameter `*rr->d` 1089. } 1090. 1091. > int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, 1092. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 1093. { crypto/bn/bn_exp.c:1138:13: Call 1136. if (BN_is_one(m)) { 1137. ret = 1; 1138. BN_zero(rr); ^ 1139. } else { 1140. ret = BN_one(rr); crypto/bn/bn_lib.c:395:1: Parameter `*a->d` 393. } 394. 395. > int BN_set_word(BIGNUM *a, BN_ULONG w) 396. { 397. bn_check_top(a); crypto/bn/bn_lib.c:398:9: Call 396. { 397. bn_check_top(a); 398. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 399. return (0); 400. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `*a->d` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:668:12: Call 666. return a; 667. 668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 669. } 670. crypto/bn/bn_lib.c:284:1: Parameter `*b->d` 282. */ 283. 284. > BIGNUM *bn_expand2(BIGNUM *b, int words) 285. { 286. bn_check_top(b); crypto/bn/bn_lib.c:289:23: Call 287. 288. if (words > b->dmax) { 289. BN_ULONG *a = bn_expand_internal(b, words); ^ 290. if (!a) 291. return NULL; crypto/bn/bn_lib.c:246:1: <Offset trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `b->top` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: <Length trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `*b->d` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:271:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_exp` 269. assert(b->top <= words); 270. if (b->top > 0) 271. memcpy(a, b->d, sizeof(*a) * b->top); ^ 272. 273. return a;
https://github.com/openssl/openssl/blob/3f97052392cb10fca5309212bf720685262ad4a6/crypto/bn/bn_lib.c/#L271
d2a_code_trace_data_45879
static int vc1_decode_p_mb(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; int i, j; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp; int mqdiff, mquant; int ttmb = v->ttfrm; int status; static const int size_table[6] = { 0, 2, 3, 4, 5, 8 }, offset_table[6] = { 0, 1, 3, 7, 15, 31 }; int mb_has_coeffs = 1; int dmv_x, dmv_y; int index, index1; int val, sign; int first_block = 1; int dst_idx, off; int skipped, fourmv; mquant = v->pq; if (v->mv_type_is_raw) fourmv = get_bits1(gb); else fourmv = v->mv_type_mb_plane[mb_pos]; if (v->skip_is_raw) skipped = get_bits1(gb); else skipped = v->s.mbskip_table[mb_pos]; s->dsp.clear_blocks(s->block[0]); if (!fourmv) { if (!skipped) { GET_MVDATA(dmv_x, dmv_y); if (s->mb_intra) { s->current_picture.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.motion_val[1][s->block_index[0]][1] = 0; } s->current_picture.mb_type[mb_pos] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16; vc1_pred_mv(s, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0]); if (s->mb_intra && !mb_has_coeffs) { GET_MQUANT(); s->ac_pred = get_bits1(gb); cbp = 0; } else if (mb_has_coeffs) { if (s->mb_intra) s->ac_pred = get_bits1(gb); cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); GET_MQUANT(); } else { mquant = v->pq; cbp = 0; } s->current_picture.qscale_table[mb_pos] = mquant; if (!v->ttmbf && !s->mb_intra && mb_has_coeffs) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); if(!s->mb_intra) vc1_mc_1mv(v, 0); dst_idx = 0; for (i=0; i<6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); v->mb_type[0][s->block_index[i]] = s->mb_intra; if(s->mb_intra) { v->a_avail = v->c_avail = 0; if(i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if(i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; s->dsp.vc1_inv_trans_8x8(s->block[i]); if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); if(v->pq >= 9 && v->overlap) { if(v->c_avail) s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); if(v->a_avail) s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); } } else if(val) { vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY)); if(!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } else { s->mb_intra = 0; for(i = 0; i < 6; i++) { v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP; s->current_picture.qscale_table[mb_pos] = 0; vc1_pred_mv(s, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0]); vc1_mc_1mv(v, 0); return 0; } } else { if (!skipped ) { int intra_count = 0, coded_inter = 0; int is_intra[6], is_coded[6]; cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); for (i=0; i<6; i++) { val = ((cbp >> (5 - i)) & 1); s->dc_val[0][s->block_index[i]] = 0; s->mb_intra = 0; if(i < 4) { dmv_x = dmv_y = 0; s->mb_intra = 0; mb_has_coeffs = 0; if(val) { GET_MVDATA(dmv_x, dmv_y); } vc1_pred_mv(s, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0]); if(!s->mb_intra) vc1_mc_4mv_luma(v, i); intra_count += s->mb_intra; is_intra[i] = s->mb_intra; is_coded[i] = mb_has_coeffs; } if(i&4){ is_intra[i] = (intra_count >= 3); is_coded[i] = val; } if(i == 4) vc1_mc_4mv_chroma(v); v->mb_type[0][s->block_index[i]] = is_intra[i]; if(!coded_inter) coded_inter = !is_intra[i] & is_coded[i]; } if(!intra_count && !coded_inter) return 0; dst_idx = 0; GET_MQUANT(); s->current_picture.qscale_table[mb_pos] = mquant; { int intrapred = 0; for(i=0; i<6; i++) if(is_intra[i]) { if(((!s->first_slice_line || (i==2 || i==3)) && v->mb_type[0][s->block_index[i] - s->block_wrap[i]]) || ((s->mb_x || (i==1 || i==3)) && v->mb_type[0][s->block_index[i] - 1])) { intrapred = 1; break; } } if(intrapred)s->ac_pred = get_bits1(gb); else s->ac_pred = 0; } if (!v->ttmbf && coded_inter) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); for (i=0; i<6; i++) { dst_idx += i >> 2; off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); s->mb_intra = is_intra[i]; if (is_intra[i]) { v->a_avail = v->c_avail = 0; if(i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if(i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset); if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; s->dsp.vc1_inv_trans_8x8(s->block[i]); if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize); if(v->pq >= 9 && v->overlap) { if(v->c_avail) s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); if(v->a_avail) s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); } } else if(is_coded[i]) { status = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY)); if(!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } return status; } else { s->mb_intra = 0; s->current_picture.qscale_table[mb_pos] = 0; for (i=0; i<6; i++) { v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } for (i=0; i<4; i++) { vc1_pred_mv(s, i, 0, 0, 0, v->range_x, v->range_y, v->mb_type[0]); vc1_mc_4mv_luma(v, i); } vc1_mc_4mv_chroma(v); s->current_picture.qscale_table[mb_pos] = 0; return 0; } } return -1; } libavcodec/vc1.c:3095: error: Buffer Overrun L2 Offset: [0, 63] Size: 2. libavcodec/vc1.c:3095:44: <Offset trace> 3093. if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; 3094. s->dsp.vc1_inv_trans_8x8(s->block[i]); 3095. if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; ^ 3096. s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); 3097. if(v->pq >= 9 && v->overlap) { libavcodec/vc1.c:3095:44: Assignment 3093. if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; 3094. s->dsp.vc1_inv_trans_8x8(s->block[i]); 3095. if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; ^ 3096. s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); 3097. if(v->pq >= 9 && v->overlap) { libavcodec/vc1.c:3092:21: <Length trace> 3090. v->c_avail = v->mb_type[0][s->block_index[i] - 1]; 3091. 3092. vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); ^ 3093. if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; 3094. s->dsp.vc1_inv_trans_8x8(s->block[i]); libavcodec/vc1.c:3092:21: Call 3090. v->c_avail = v->mb_type[0][s->block_index[i] - 1]; 3091. 3092. vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); ^ 3093. if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; 3094. s->dsp.vc1_inv_trans_8x8(s->block[i]); libavcodec/vc1.c:2693:1: Parameter `*block` 2691. * @param codingset set of VLC to decode data 2692. */ 2693. static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int coded, int mquant, int codingset) ^ 2694. { 2695. GetBitContext *gb = &v->s.gb; libavcodec/vc1.c:3095:64: Array access: Offset: [0, 63] Size: 2 3093. if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; 3094. s->dsp.vc1_inv_trans_8x8(s->block[i]); 3095. if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; ^ 3096. s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); 3097. if(v->pq >= 9 && v->overlap) {
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vc1.c/#L3095
d2a_code_trace_data_45880
static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) { tls_curve_info *cinfo; if (curve[0]) return 1; if ((curve[1] < 1) || ((size_t)curve[1] > sizeof(nid_list)/sizeof(nid_list[0]))) return 0; cinfo = &nid_list[curve[1]-1]; return ssl_security(s, op, cinfo->secbits, cinfo->nid, (void *)curve); } ssl/t1_lib.c:1277: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: 28 by call to `tls_curve_allowed`. Showing all 7 steps of the trace ssl/t1_lib.c:1109:1: Parameter `*s->session->tlsext_ellipticcurvelist` 1107. } 1108. 1109. > unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *buf, unsigned char *limit, int *al) 1110. { 1111. int extdatalen=0; ssl/t1_lib.c:1277:8: Call 1275. for (i = 0; i < plistlen; i += 2, plist += 2) 1276. { 1277. if (tls_curve_allowed(s, plist, SSL_SECOP_CURVE_SUPPORTED)) ^ 1278. { 1279. *etmp++ = plist[0]; ssl/t1_lib.c:429:1: <Offset trace> 427. 428. /* See if curve is allowed by security callback */ 429. > static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) 430. { 431. tls_curve_info *cinfo; ssl/t1_lib.c:429:1: Parameter `*curve` 427. 428. /* See if curve is allowed by security callback */ 429. > static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) 430. { 431. tls_curve_info *cinfo; ssl/t1_lib.c:235:1: <Length trace> 233. #define TLS_CURVE_PRIME 0x0 234. 235. > static tls_curve_info nid_list[] = 236. { 237. {NID_sect163k1, 80, TLS_CURVE_CHAR2},/* sect163k1 (1) */ ssl/t1_lib.c:235:1: Array declaration 233. #define TLS_CURVE_PRIME 0x0 234. 235. > static tls_curve_info nid_list[] = 236. { 237. {NID_sect163k1, 80, TLS_CURVE_CHAR2},/* sect163k1 (1) */ ssl/t1_lib.c:437:2: Array access: Offset: [-1, +oo] Size: 28 by call to `tls_curve_allowed` 435. sizeof(nid_list)/sizeof(nid_list[0]))) 436. return 0; 437. cinfo = &nid_list[curve[1]-1]; ^ 438. return ssl_security(s, op, cinfo->secbits, cinfo->nid, (void *)curve); 439. }
https://github.com/openssl/openssl/blob/924e5eda2c82d737cc5a1b9c37918aa6e34825da/ssl/t1_lib.c/#L437
d2a_code_trace_data_45881
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:847: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_mul`. Showing all 25 steps of the trace test/bntest.c:845:13: Call 843. BN_bntest_rand(d, 512, 0, 0); 844. for (j = 0; j < 2; j++) { 845. BN_GF2m_mod_exp(e, a, c, b[j], ctx); ^ 846. BN_GF2m_mod_exp(f, a, d, b[j], ctx); 847. BN_GF2m_mod_mul(e, e, f, b[j], ctx); crypto/bn/bn_gf2m.c:897:1: Parameter `ctx->stack.depth` 895. * for best performance, use the BN_GF2m_mod_exp_arr function. 896. */ 897. > int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 898. const BIGNUM *p, BN_CTX *ctx) 899. { test/bntest.c:846:13: Call 844. for (j = 0; j < 2; j++) { 845. BN_GF2m_mod_exp(e, a, c, b[j], ctx); 846. BN_GF2m_mod_exp(f, a, d, b[j], ctx); ^ 847. BN_GF2m_mod_mul(e, e, f, b[j], ctx); 848. BN_add(f, c, d); crypto/bn/bn_gf2m.c:897:1: Parameter `ctx->stack.depth` 895. * for best performance, use the BN_GF2m_mod_exp_arr function. 896. */ 897. > int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 898. const BIGNUM *p, BN_CTX *ctx) 899. { test/bntest.c:847:13: Call 845. BN_GF2m_mod_exp(e, a, c, b[j], ctx); 846. BN_GF2m_mod_exp(f, a, d, b[j], ctx); 847. BN_GF2m_mod_mul(e, e, f, b[j], ctx); ^ 848. BN_add(f, c, d); 849. BN_GF2m_mod_exp(f, a, f, b[j], ctx); crypto/bn/bn_gf2m.c:465:1: Parameter `ctx->stack.depth` 463. * BN_GF2m_mod_mul_arr function. 464. */ 465. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 466. const BIGNUM *p, BN_CTX *ctx) 467. { test/bntest.c:849:13: Call 847. BN_GF2m_mod_mul(e, e, f, b[j], ctx); 848. BN_add(f, c, d); 849. BN_GF2m_mod_exp(f, a, f, b[j], ctx); ^ 850. BN_GF2m_add(f, e, f); 851. /* Test that a^(c+d)=a^c*a^d. */ crypto/bn/bn_gf2m.c:897:1: Parameter `ctx->stack.depth` 895. * for best performance, use the BN_GF2m_mod_exp_arr function. 896. */ 897. > int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 898. const BIGNUM *p, BN_CTX *ctx) 899. { test/bntest.c:845:13: Call 843. BN_bntest_rand(d, 512, 0, 0); 844. for (j = 0; j < 2; j++) { 845. BN_GF2m_mod_exp(e, a, c, b[j], ctx); ^ 846. BN_GF2m_mod_exp(f, a, d, b[j], ctx); 847. BN_GF2m_mod_mul(e, e, f, b[j], ctx); crypto/bn/bn_gf2m.c:897:1: Parameter `ctx->stack.depth` 895. * for best performance, use the BN_GF2m_mod_exp_arr function. 896. */ 897. > int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 898. const BIGNUM *p, BN_CTX *ctx) 899. { test/bntest.c:846:13: Call 844. for (j = 0; j < 2; j++) { 845. BN_GF2m_mod_exp(e, a, c, b[j], ctx); 846. BN_GF2m_mod_exp(f, a, d, b[j], ctx); ^ 847. BN_GF2m_mod_mul(e, e, f, b[j], ctx); 848. BN_add(f, c, d); crypto/bn/bn_gf2m.c:897:1: Parameter `ctx->stack.depth` 895. * for best performance, use the BN_GF2m_mod_exp_arr function. 896. */ 897. > int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 898. const BIGNUM *p, BN_CTX *ctx) 899. { test/bntest.c:847:13: Call 845. BN_GF2m_mod_exp(e, a, c, b[j], ctx); 846. BN_GF2m_mod_exp(f, a, d, b[j], ctx); 847. BN_GF2m_mod_mul(e, e, f, b[j], ctx); ^ 848. BN_add(f, c, d); 849. BN_GF2m_mod_exp(f, a, f, b[j], ctx); crypto/bn/bn_gf2m.c:465:1: Parameter `ctx->stack.depth` 463. * BN_GF2m_mod_mul_arr function. 464. */ 465. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 466. const BIGNUM *p, BN_CTX *ctx) 467. { crypto/bn/bn_gf2m.c:481:11: Call 479. goto err; 480. } 481. ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx); ^ 482. bn_check_top(r); 483. err: crypto/bn/bn_gf2m.c:424:5: Call 422. } 423. 424. BN_CTX_start(ctx); ^ 425. if ((s = BN_CTX_get(ctx)) == NULL) 426. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gf2m.c:454:5: Call 452. 453. err: 454. BN_CTX_end(ctx); ^ 455. return ret; 456. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_mul` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_45882
int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, int *pclass, long omax) { int i, ret; long l; const unsigned char *p = *pp; int tag, xclass, inf; long max = omax; if (!max) goto err; ret = (*p & V_ASN1_CONSTRUCTED); xclass = (*p & V_ASN1_PRIVATE); i = *p & V_ASN1_PRIMITIVE_TAG; if (i == V_ASN1_PRIMITIVE_TAG) { p++; if (--max == 0) goto err; l = 0; while (*p & 0x80) { l <<= 7L; l |= *(p++) & 0x7f; if (--max == 0) goto err; if (l > (INT_MAX >> 7L)) goto err; } l <<= 7L; l |= *(p++) & 0x7f; tag = (int)l; if (--max == 0) goto err; } else { tag = i; p++; if (--max == 0) goto err; } *ptag = tag; *pclass = xclass; if (!asn1_get_length(&p, &inf, plength, max)) goto err; if (inf && !(ret & V_ASN1_CONSTRUCTED)) goto err; if (*plength > (omax - (p - *pp))) { ASN1err(ASN1_F_ASN1_GET_OBJECT, ASN1_R_TOO_LONG); ret |= 0x80; } *pp = p; return ret | inf; err: ASN1err(ASN1_F_ASN1_GET_OBJECT, ASN1_R_HEADER_TOO_LONG); return 0x80; } fuzz/test-corpus.c:55: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, +oo] by call to `FuzzerTestOneInput`. Showing all 23 steps of the trace fuzz/test-corpus.c:51:11: Array declaration 49. if (f == NULL) 50. return; 51. buf = malloc(st.st_size); ^ 52. if (buf != NULL) { 53. s = fread(buf, 1, st.st_size, f); fuzz/test-corpus.c:51:5: Assignment 49. if (f == NULL) 50. return; 51. buf = malloc(st.st_size); ^ 52. if (buf != NULL) { 53. s = fread(buf, 1, st.st_size, f); fuzz/test-corpus.c:55:9: Call 53. s = fread(buf, 1, st.st_size, f); 54. OPENSSL_assert(s == (size_t)st.st_size); 55. FuzzerTestOneInput(buf, s); ^ 56. free(buf); 57. } fuzz/x509.c:28:1: Parameter `*buf` 26. } 27. 28. > int FuzzerTestOneInput(const uint8_t *buf, size_t len) 29. { 30. const unsigned char *p = buf; fuzz/x509.c:30:5: Assignment 28. int FuzzerTestOneInput(const uint8_t *buf, size_t len) 29. { 30. const unsigned char *p = buf; ^ 31. unsigned char *der = NULL; 32. fuzz/x509.c:33:18: Call 31. unsigned char *der = NULL; 32. 33. X509 *x509 = d2i_X509(NULL, &p, len); ^ 34. if (x509 != NULL) { 35. BIO *bio = BIO_new(BIO_s_null()); crypto/x509/x_x509.c:109:1: Parameter `**in` 107. } ASN1_SEQUENCE_END_ref(X509, X509) 108. 109. > IMPLEMENT_ASN1_FUNCTIONS(X509) 110. IMPLEMENT_ASN1_DUP_FUNCTION(X509) 111. crypto/x509/x_x509.c:109:1: Call 107. } ASN1_SEQUENCE_END_ref(X509, X509) 108. 109. > IMPLEMENT_ASN1_FUNCTIONS(X509) 110. IMPLEMENT_ASN1_DUP_FUNCTION(X509) 111. crypto/asn1/tasn_dec.c:105:1: Parameter `**in` 103. */ 104. 105. > ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, 106. const unsigned char **in, long len, 107. const ASN1_ITEM *it) crypto/asn1/tasn_dec.c:114:9: Call 112. pval = &ptmpval; 113. asn1_tlc_clear_nc(&c); 114. if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) ^ 115. return *pval; 116. return NULL; crypto/asn1/tasn_dec.c:119:1: Parameter `**in` 117. } 118. 119. > int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, 120. const ASN1_ITEM *it, 121. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:124:10: Call 122. { 123. int rv; 124. rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx, 0); ^ 125. if (rv <= 0) 126. ASN1_item_ex_free(pval, it); crypto/asn1/tasn_dec.c:135:1: Parameter `**in` 133. */ 134. 135. > static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, 136. long len, const ASN1_ITEM *it, 137. int tag, int aclass, char opt, ASN1_TLC *ctx, crypto/asn1/tasn_dec.c:185:9: Assignment 183. 184. case ASN1_ITYPE_MSTRING: 185. p = *in; ^ 186. /* Just read in tag and class */ 187. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, crypto/asn1/tasn_dec.c:187:15: Call 185. p = *in; 186. /* Just read in tag and class */ 187. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, ^ 188. &p, len, -1, 0, 1, ctx); 189. if (!ret) { crypto/asn1/tasn_dec.c:1078:1: Parameter `**in` 1076. */ 1077. 1078. > static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, 1079. char *inf, char *cst, 1080. const unsigned char **in, long len, crypto/asn1/tasn_dec.c:1087:5: Assignment 1085. long plen; 1086. const unsigned char *p, *q; 1087. p = *in; ^ 1088. q = p; 1089. crypto/asn1/tasn_dec.c:1097:13: Call 1095. p += ctx->hdrlen; 1096. } else { 1097. i = ASN1_get_object(&p, &plen, &ptag, &pclass, len); ^ 1098. if (ctx) { 1099. ctx->ret = i; crypto/asn1/asn1_lib.c:44:1: <Length trace> 42. } 43. 44. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 45. int *pclass, long omax) 46. { crypto/asn1/asn1_lib.c:44:1: Parameter `**pp` 42. } 43. 44. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 45. int *pclass, long omax) 46. { crypto/asn1/asn1_lib.c:49:5: Assignment 47. int i, ret; 48. long l; 49. const unsigned char *p = *pp; ^ 50. int tag, xclass, inf; 51. long max = omax; crypto/asn1/asn1_lib.c:59:9: Assignment 57. i = *p & V_ASN1_PRIMITIVE_TAG; 58. if (i == V_ASN1_PRIMITIVE_TAG) { /* high-tag */ 59. p++; ^ 60. if (--max == 0) 61. goto err; crypto/asn1/asn1_lib.c:63:16: Array access: Offset: [1, +oo] Size: [0, +oo] by call to `FuzzerTestOneInput` 61. goto err; 62. l = 0; 63. while (*p & 0x80) { ^ 64. l <<= 7L; 65. l |= *(p++) & 0x7f;
https://github.com/openssl/openssl/blob/bcf082d130a413a728a382bd6e6bfdbf2cedba45/crypto/asn1/asn1_lib.c/#L63
d2a_code_trace_data_45883
int MAIN(int argc, char **argv) { ENGINE *e = NULL; int ret=1; X509_REQ *req=NULL; X509 *x=NULL,*xca=NULL; ASN1_OBJECT *objtmp; STACK_OF(OPENSSL_STRING) *sigopts = NULL; EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL; ASN1_INTEGER *sno = NULL; int i,num,badops=0; BIO *out=NULL; BIO *STDout=NULL; STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL; int informat,outformat,keyformat,CAformat,CAkeyformat; char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL; char *CAkeyfile=NULL,*CAserial=NULL; char *fkeyfile=NULL; char *alias=NULL; int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0; int next_serial=0; int subject_hash=0,issuer_hash=0,ocspid=0; #ifndef OPENSSL_NO_MD5 int subject_hash_old=0,issuer_hash_old=0; #endif int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0; int ocsp_uri=0; int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0; int C=0; int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0; int pprint = 0; const char **pp; X509_STORE *ctx=NULL; X509_REQ *rq=NULL; int fingerprint=0; char buf[256]; const EVP_MD *md_alg,*digest=NULL; CONF *extconf = NULL; char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL; int need_rand = 0; int checkend=0,checkoffset=0; unsigned long nmflag = 0, certflag = 0; unsigned char *checkhost = NULL, *checkemail = NULL; char *checkip = NULL; #ifndef OPENSSL_NO_ENGINE char *engine=NULL; #endif reqfile=0; apps_startup(); if (bio_err == NULL) bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); if (!load_config(bio_err, NULL)) goto end; STDout=BIO_new_fp(stdout,BIO_NOCLOSE); #ifdef OPENSSL_SYS_VMS { BIO *tmpbio = BIO_new(BIO_f_linebuffer()); STDout = BIO_push(tmpbio, STDout); } #endif informat=FORMAT_PEM; outformat=FORMAT_PEM; keyformat=FORMAT_PEM; CAformat=FORMAT_PEM; CAkeyformat=FORMAT_PEM; ctx=X509_STORE_new(); if (ctx == NULL) goto end; X509_STORE_set_verify_cb(ctx,callb); argc--; argv++; num=0; while (argc >= 1) { if (strcmp(*argv,"-inform") == 0) { if (--argc < 1) goto bad; informat=str2fmt(*(++argv)); } else if (strcmp(*argv,"-outform") == 0) { if (--argc < 1) goto bad; outformat=str2fmt(*(++argv)); } else if (strcmp(*argv,"-keyform") == 0) { if (--argc < 1) goto bad; keyformat=str2fmt(*(++argv)); } else if (strcmp(*argv,"-req") == 0) { reqfile=1; need_rand = 1; } else if (strcmp(*argv,"-CAform") == 0) { if (--argc < 1) goto bad; CAformat=str2fmt(*(++argv)); } else if (strcmp(*argv,"-CAkeyform") == 0) { if (--argc < 1) goto bad; CAkeyformat=str2fmt(*(++argv)); } else if (strcmp(*argv,"-sigopt") == 0) { if (--argc < 1) goto bad; if (!sigopts) sigopts = sk_OPENSSL_STRING_new_null(); if (!sigopts || !sk_OPENSSL_STRING_push(sigopts, *(++argv))) goto bad; } else if (strcmp(*argv,"-days") == 0) { if (--argc < 1) goto bad; days=atoi(*(++argv)); if (days == 0) { BIO_printf(bio_err,"bad number of days\n"); goto bad; } } else if (strcmp(*argv,"-passin") == 0) { if (--argc < 1) goto bad; passargin= *(++argv); } else if (strcmp(*argv,"-extfile") == 0) { if (--argc < 1) goto bad; extfile= *(++argv); } else if (strcmp(*argv,"-extensions") == 0) { if (--argc < 1) goto bad; extsect= *(++argv); } else if (strcmp(*argv,"-in") == 0) { if (--argc < 1) goto bad; infile= *(++argv); } else if (strcmp(*argv,"-out") == 0) { if (--argc < 1) goto bad; outfile= *(++argv); } else if (strcmp(*argv,"-signkey") == 0) { if (--argc < 1) goto bad; keyfile= *(++argv); sign_flag= ++num; need_rand = 1; } else if (strcmp(*argv,"-CA") == 0) { if (--argc < 1) goto bad; CAfile= *(++argv); CA_flag= ++num; need_rand = 1; } else if (strcmp(*argv,"-CAkey") == 0) { if (--argc < 1) goto bad; CAkeyfile= *(++argv); } else if (strcmp(*argv,"-CAserial") == 0) { if (--argc < 1) goto bad; CAserial= *(++argv); } else if (strcmp(*argv,"-set_serial") == 0) { if (--argc < 1) goto bad; if (!(sno = s2i_ASN1_INTEGER(NULL, *(++argv)))) goto bad; } else if (strcmp(*argv,"-force_pubkey") == 0) { if (--argc < 1) goto bad; fkeyfile= *(++argv); } else if (strcmp(*argv,"-addtrust") == 0) { if (--argc < 1) goto bad; if (!(objtmp = OBJ_txt2obj(*(++argv), 0))) { BIO_printf(bio_err, "Invalid trust object value %s\n", *argv); goto bad; } if (!trust) trust = sk_ASN1_OBJECT_new_null(); sk_ASN1_OBJECT_push(trust, objtmp); trustout = 1; } else if (strcmp(*argv,"-addreject") == 0) { if (--argc < 1) goto bad; if (!(objtmp = OBJ_txt2obj(*(++argv), 0))) { BIO_printf(bio_err, "Invalid reject object value %s\n", *argv); goto bad; } if (!reject) reject = sk_ASN1_OBJECT_new_null(); sk_ASN1_OBJECT_push(reject, objtmp); trustout = 1; } else if (strcmp(*argv,"-setalias") == 0) { if (--argc < 1) goto bad; alias= *(++argv); trustout = 1; } else if (strcmp(*argv,"-certopt") == 0) { if (--argc < 1) goto bad; if (!set_cert_ex(&certflag, *(++argv))) goto bad; } else if (strcmp(*argv,"-nameopt") == 0) { if (--argc < 1) goto bad; if (!set_name_ex(&nmflag, *(++argv))) goto bad; } #ifndef OPENSSL_NO_ENGINE else if (strcmp(*argv,"-engine") == 0) { if (--argc < 1) goto bad; engine= *(++argv); } #endif else if (strcmp(*argv,"-C") == 0) C= ++num; else if (strcmp(*argv,"-email") == 0) email= ++num; else if (strcmp(*argv,"-ocsp_uri") == 0) ocsp_uri= ++num; else if (strcmp(*argv,"-serial") == 0) serial= ++num; else if (strcmp(*argv,"-next_serial") == 0) next_serial= ++num; else if (strcmp(*argv,"-modulus") == 0) modulus= ++num; else if (strcmp(*argv,"-pubkey") == 0) pubkey= ++num; else if (strcmp(*argv,"-x509toreq") == 0) x509req= ++num; else if (strcmp(*argv,"-text") == 0) text= ++num; else if (strcmp(*argv,"-hash") == 0 || strcmp(*argv,"-subject_hash") == 0) subject_hash= ++num; #ifndef OPENSSL_NO_MD5 else if (strcmp(*argv,"-subject_hash_old") == 0) subject_hash_old= ++num; #endif else if (strcmp(*argv,"-issuer_hash") == 0) issuer_hash= ++num; #ifndef OPENSSL_NO_MD5 else if (strcmp(*argv,"-issuer_hash_old") == 0) issuer_hash_old= ++num; #endif else if (strcmp(*argv,"-subject") == 0) subject= ++num; else if (strcmp(*argv,"-issuer") == 0) issuer= ++num; else if (strcmp(*argv,"-fingerprint") == 0) fingerprint= ++num; else if (strcmp(*argv,"-dates") == 0) { startdate= ++num; enddate= ++num; } else if (strcmp(*argv,"-purpose") == 0) pprint= ++num; else if (strcmp(*argv,"-startdate") == 0) startdate= ++num; else if (strcmp(*argv,"-enddate") == 0) enddate= ++num; else if (strcmp(*argv,"-checkend") == 0) { if (--argc < 1) goto bad; checkoffset=atoi(*(++argv)); checkend=1; } else if (strcmp(*argv,"-checkhost") == 0) { if (--argc < 1) goto bad; checkhost=(unsigned char *)*(++argv); } else if (strcmp(*argv,"-checkemail") == 0) { if (--argc < 1) goto bad; checkemail=(unsigned char *)*(++argv); } else if (strcmp(*argv,"-checkip") == 0) { if (--argc < 1) goto bad; checkip=*(++argv); } else if (strcmp(*argv,"-noout") == 0) noout= ++num; else if (strcmp(*argv,"-trustout") == 0) trustout= 1; else if (strcmp(*argv,"-clrtrust") == 0) clrtrust= ++num; else if (strcmp(*argv,"-clrreject") == 0) clrreject= ++num; else if (strcmp(*argv,"-alias") == 0) aliasout= ++num; else if (strcmp(*argv,"-CAcreateserial") == 0) CA_createserial= ++num; else if (strcmp(*argv,"-clrext") == 0) clrext = 1; #if 1 else if (strcmp(*argv,"-crlext") == 0) { BIO_printf(bio_err,"use -clrext instead of -crlext\n"); clrext = 1; } #endif else if (strcmp(*argv,"-ocspid") == 0) ocspid= ++num; else if ((md_alg=EVP_get_digestbyname(*argv + 1))) { digest=md_alg; } else { BIO_printf(bio_err,"unknown option %s\n",*argv); badops=1; break; } argc--; argv++; } if (badops) { bad: for (pp=x509_usage; (*pp != NULL); pp++) BIO_printf(bio_err,"%s",*pp); goto end; } #ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); #endif if (need_rand) app_RAND_load_file(NULL, bio_err, 0); ERR_load_crypto_strings(); if (!app_passwd(bio_err, passargin, NULL, &passin, NULL)) { BIO_printf(bio_err, "Error getting password\n"); goto end; } if (!X509_STORE_set_default_paths(ctx)) { ERR_print_errors(bio_err); goto end; } if (fkeyfile) { fkey = load_pubkey(bio_err, fkeyfile, keyformat, 0, NULL, e, "Forced key"); if (fkey == NULL) goto end; } if ((CAkeyfile == NULL) && (CA_flag) && (CAformat == FORMAT_PEM)) { CAkeyfile=CAfile; } else if ((CA_flag) && (CAkeyfile == NULL)) { BIO_printf(bio_err,"need to specify a CAkey if using the CA command\n"); goto end; } if (extfile) { long errorline = -1; X509V3_CTX ctx2; extconf = NCONF_new(NULL); if (!NCONF_load(extconf, extfile,&errorline)) { if (errorline <= 0) BIO_printf(bio_err, "error loading the config file '%s'\n", extfile); else BIO_printf(bio_err, "error on line %ld of config file '%s'\n" ,errorline,extfile); goto end; } if (!extsect) { extsect = NCONF_get_string(extconf, "default", "extensions"); if (!extsect) { ERR_clear_error(); extsect = "default"; } } X509V3_set_ctx_test(&ctx2); X509V3_set_nconf(&ctx2, extconf); if (!X509V3_EXT_add_nconf(extconf, &ctx2, extsect, NULL)) { BIO_printf(bio_err, "Error Loading extension section %s\n", extsect); ERR_print_errors(bio_err); goto end; } } if (reqfile) { EVP_PKEY *pkey; BIO *in; if (!sign_flag && !CA_flag) { BIO_printf(bio_err,"We need a private key to sign with\n"); goto end; } in=BIO_new(BIO_s_file()); if (in == NULL) { ERR_print_errors(bio_err); goto end; } if (infile == NULL) BIO_set_fp(in,stdin,BIO_NOCLOSE|BIO_FP_TEXT); else { if (BIO_read_filename(in,infile) <= 0) { perror(infile); BIO_free(in); goto end; } } req=PEM_read_bio_X509_REQ(in,NULL,NULL,NULL); BIO_free(in); if (req == NULL) { ERR_print_errors(bio_err); goto end; } if ( (req->req_info == NULL) || (req->req_info->pubkey == NULL) || (req->req_info->pubkey->public_key == NULL) || (req->req_info->pubkey->public_key->data == NULL)) { BIO_printf(bio_err,"The certificate request appears to corrupted\n"); BIO_printf(bio_err,"It does not contain a public key\n"); goto end; } if ((pkey=X509_REQ_get_pubkey(req)) == NULL) { BIO_printf(bio_err,"error unpacking public key\n"); goto end; } i=X509_REQ_verify(req,pkey); EVP_PKEY_free(pkey); if (i < 0) { BIO_printf(bio_err,"Signature verification error\n"); ERR_print_errors(bio_err); goto end; } if (i == 0) { BIO_printf(bio_err,"Signature did not match the certificate request\n"); goto end; } else BIO_printf(bio_err,"Signature ok\n"); print_name(bio_err, "subject=", X509_REQ_get_subject_name(req), nmflag); if ((x=X509_new()) == NULL) goto end; if (sno == NULL) { sno = ASN1_INTEGER_new(); if (!sno || !rand_serial(NULL, sno)) goto end; if (!X509_set_serialNumber(x, sno)) goto end; ASN1_INTEGER_free(sno); sno = NULL; } else if (!X509_set_serialNumber(x, sno)) goto end; if (!X509_set_issuer_name(x,req->req_info->subject)) goto end; if (!X509_set_subject_name(x,req->req_info->subject)) goto end; X509_gmtime_adj(X509_get_notBefore(x),0); X509_time_adj_ex(X509_get_notAfter(x),days, 0, NULL); if (fkey) X509_set_pubkey(x, fkey); else { pkey = X509_REQ_get_pubkey(req); X509_set_pubkey(x,pkey); EVP_PKEY_free(pkey); } } else x=load_cert(bio_err,infile,informat,NULL,e,"Certificate"); if (x == NULL) goto end; if (CA_flag) { xca=load_cert(bio_err,CAfile,CAformat,NULL,e,"CA Certificate"); if (xca == NULL) goto end; } if (!noout || text || next_serial) { OBJ_create("2.99999.3", "SET.ex3","SET x509v3 extension 3"); out=BIO_new(BIO_s_file()); if (out == NULL) { ERR_print_errors(bio_err); goto end; } if (outfile == NULL) { BIO_set_fp(out,stdout,BIO_NOCLOSE); #ifdef OPENSSL_SYS_VMS { BIO *tmpbio = BIO_new(BIO_f_linebuffer()); out = BIO_push(tmpbio, out); } #endif } else { if (BIO_write_filename(out,outfile) <= 0) { perror(outfile); goto end; } } } if (alias) X509_alias_set1(x, (unsigned char *)alias, -1); if (clrtrust) X509_trust_clear(x); if (clrreject) X509_reject_clear(x); if (trust) { for (i = 0; i < sk_ASN1_OBJECT_num(trust); i++) { objtmp = sk_ASN1_OBJECT_value(trust, i); X509_add1_trust_object(x, objtmp); } } if (reject) { for (i = 0; i < sk_ASN1_OBJECT_num(reject); i++) { objtmp = sk_ASN1_OBJECT_value(reject, i); X509_add1_reject_object(x, objtmp); } } if (num) { for (i=1; i<=num; i++) { if (issuer == i) { print_name(STDout, "issuer= ", X509_get_issuer_name(x), nmflag); } else if (subject == i) { print_name(STDout, "subject= ", X509_get_subject_name(x), nmflag); } else if (serial == i) { BIO_printf(STDout,"serial="); i2a_ASN1_INTEGER(STDout, X509_get_serialNumber(x)); BIO_printf(STDout,"\n"); } else if (next_serial == i) { BIGNUM *bnser; ASN1_INTEGER *ser; ser = X509_get_serialNumber(x); bnser = ASN1_INTEGER_to_BN(ser, NULL); if (!bnser) goto end; if (!BN_add_word(bnser, 1)) goto end; ser = BN_to_ASN1_INTEGER(bnser, NULL); if (!ser) goto end; BN_free(bnser); i2a_ASN1_INTEGER(out, ser); ASN1_INTEGER_free(ser); BIO_puts(out, "\n"); } else if ((email == i) || (ocsp_uri == i)) { int j; STACK_OF(OPENSSL_STRING) *emlst; if (email == i) emlst = X509_get1_email(x); else emlst = X509_get1_ocsp(x); for (j = 0; j < sk_OPENSSL_STRING_num(emlst); j++) BIO_printf(STDout, "%s\n", sk_OPENSSL_STRING_value(emlst, j)); X509_email_free(emlst); } else if (aliasout == i) { unsigned char *alstr; alstr = X509_alias_get0(x, NULL); if (alstr) BIO_printf(STDout,"%s\n", alstr); else BIO_puts(STDout,"<No Alias>\n"); } else if (subject_hash == i) { BIO_printf(STDout,"%08lx\n",X509_subject_name_hash(x)); } #ifndef OPENSSL_NO_MD5 else if (subject_hash_old == i) { BIO_printf(STDout,"%08lx\n",X509_subject_name_hash_old(x)); } #endif else if (issuer_hash == i) { BIO_printf(STDout,"%08lx\n",X509_issuer_name_hash(x)); } #ifndef OPENSSL_NO_MD5 else if (issuer_hash_old == i) { BIO_printf(STDout,"%08lx\n",X509_issuer_name_hash_old(x)); } #endif else if (pprint == i) { X509_PURPOSE *ptmp; int j; BIO_printf(STDout, "Certificate purposes:\n"); for (j = 0; j < X509_PURPOSE_get_count(); j++) { ptmp = X509_PURPOSE_get0(j); purpose_print(STDout, x, ptmp); } } else if (modulus == i) { EVP_PKEY *pkey; pkey=X509_get_pubkey(x); if (pkey == NULL) { BIO_printf(bio_err,"Modulus=unavailable\n"); ERR_print_errors(bio_err); goto end; } BIO_printf(STDout,"Modulus="); #ifndef OPENSSL_NO_RSA if (pkey->type == EVP_PKEY_RSA) BN_print(STDout,pkey->pkey.rsa->n); else #endif #ifndef OPENSSL_NO_DSA if (pkey->type == EVP_PKEY_DSA) BN_print(STDout,pkey->pkey.dsa->pub_key); else #endif BIO_printf(STDout,"Wrong Algorithm type"); BIO_printf(STDout,"\n"); EVP_PKEY_free(pkey); } else if (pubkey == i) { EVP_PKEY *pkey; pkey=X509_get_pubkey(x); if (pkey == NULL) { BIO_printf(bio_err,"Error getting public key\n"); ERR_print_errors(bio_err); goto end; } PEM_write_bio_PUBKEY(STDout, pkey); EVP_PKEY_free(pkey); } else if (C == i) { unsigned char *d; char *m; int y,z; X509_NAME_oneline(X509_get_subject_name(x), buf,sizeof buf); BIO_printf(STDout,"/* subject:%s */\n",buf); m=X509_NAME_oneline( X509_get_issuer_name(x),buf, sizeof buf); BIO_printf(STDout,"/* issuer :%s */\n",buf); z=i2d_X509(x,NULL); m=OPENSSL_malloc(z); d=(unsigned char *)m; z=i2d_X509_NAME(X509_get_subject_name(x),&d); BIO_printf(STDout,"unsigned char XXX_subject_name[%d]={\n",z); d=(unsigned char *)m; for (y=0; y<z; y++) { BIO_printf(STDout,"0x%02X,",d[y]); if ((y & 0x0f) == 0x0f) BIO_printf(STDout,"\n"); } if (y%16 != 0) BIO_printf(STDout,"\n"); BIO_printf(STDout,"};\n"); z=i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x),&d); BIO_printf(STDout,"unsigned char XXX_public_key[%d]={\n",z); d=(unsigned char *)m; for (y=0; y<z; y++) { BIO_printf(STDout,"0x%02X,",d[y]); if ((y & 0x0f) == 0x0f) BIO_printf(STDout,"\n"); } if (y%16 != 0) BIO_printf(STDout,"\n"); BIO_printf(STDout,"};\n"); z=i2d_X509(x,&d); BIO_printf(STDout,"unsigned char XXX_certificate[%d]={\n",z); d=(unsigned char *)m; for (y=0; y<z; y++) { BIO_printf(STDout,"0x%02X,",d[y]); if ((y & 0x0f) == 0x0f) BIO_printf(STDout,"\n"); } if (y%16 != 0) BIO_printf(STDout,"\n"); BIO_printf(STDout,"};\n"); OPENSSL_free(m); } else if (text == i) { X509_print_ex(STDout,x,nmflag, certflag); } else if (startdate == i) { BIO_puts(STDout,"notBefore="); ASN1_TIME_print(STDout,X509_get_notBefore(x)); BIO_puts(STDout,"\n"); } else if (enddate == i) { BIO_puts(STDout,"notAfter="); ASN1_TIME_print(STDout,X509_get_notAfter(x)); BIO_puts(STDout,"\n"); } else if (fingerprint == i) { int j; unsigned int n; unsigned char md[EVP_MAX_MD_SIZE]; const EVP_MD *fdig = digest; if (!fdig) fdig = EVP_sha1(); if (!X509_digest(x,fdig,md,&n)) { BIO_printf(bio_err,"out of memory\n"); goto end; } BIO_printf(STDout,"%s Fingerprint=", OBJ_nid2sn(EVP_MD_type(fdig))); for (j=0; j<(int)n; j++) { BIO_printf(STDout,"%02X%c",md[j], (j+1 == (int)n) ?'\n':':'); } } else if ((sign_flag == i) && (x509req == 0)) { BIO_printf(bio_err,"Getting Private key\n"); if (Upkey == NULL) { Upkey=load_key(bio_err, keyfile, keyformat, 0, passin, e, "Private key"); if (Upkey == NULL) goto end; } assert(need_rand); if (!sign(x,Upkey,days,clrext,digest, extconf, extsect)) goto end; } else if (CA_flag == i) { BIO_printf(bio_err,"Getting CA Private Key\n"); if (CAkeyfile != NULL) { CApkey=load_key(bio_err, CAkeyfile, CAkeyformat, 0, passin, e, "CA Private Key"); if (CApkey == NULL) goto end; } assert(need_rand); if (!x509_certify(ctx,CAfile,digest,x,xca, CApkey, sigopts, CAserial,CA_createserial,days, clrext, extconf, extsect, sno)) goto end; } else if (x509req == i) { EVP_PKEY *pk; BIO_printf(bio_err,"Getting request Private Key\n"); if (keyfile == NULL) { BIO_printf(bio_err,"no request key file specified\n"); goto end; } else { pk=load_key(bio_err, keyfile, keyformat, 0, passin, e, "request key"); if (pk == NULL) goto end; } BIO_printf(bio_err,"Generating certificate request\n"); rq=X509_to_X509_REQ(x,pk,digest); EVP_PKEY_free(pk); if (rq == NULL) { ERR_print_errors(bio_err); goto end; } if (!noout) { X509_REQ_print(out,rq); PEM_write_bio_X509_REQ(out,rq); } noout=1; } else if (ocspid == i) { X509_ocspid_print(out, x); } } } if (checkend) { time_t tcheck=time(NULL) + checkoffset; if (X509_cmp_time(X509_get_notAfter(x), &tcheck) < 0) { BIO_printf(out,"Certificate will expire\n"); ret=1; } else { BIO_printf(out,"Certificate will not expire\n"); ret=0; } goto end; } print_cert_checks(STDout, x, checkhost, checkemail, checkip); if (noout) { ret=0; goto end; } if (outformat == FORMAT_ASN1) i=i2d_X509_bio(out,x); else if (outformat == FORMAT_PEM) { if (trustout) i=PEM_write_bio_X509_AUX(out,x); else i=PEM_write_bio_X509(out,x); } else if (outformat == FORMAT_NETSCAPE) { NETSCAPE_X509 nx; ASN1_OCTET_STRING hdr; hdr.data=(unsigned char *)NETSCAPE_CERT_HDR; hdr.length=strlen(NETSCAPE_CERT_HDR); nx.header= &hdr; nx.cert=x; i=ASN1_item_i2d_bio(ASN1_ITEM_rptr(NETSCAPE_X509),out,&nx); } else { BIO_printf(bio_err,"bad output format specified for outfile\n"); goto end; } if (!i) { BIO_printf(bio_err,"unable to write certificate\n"); ERR_print_errors(bio_err); goto end; } ret=0; end: if (need_rand) app_RAND_write_file(NULL, bio_err); OBJ_cleanup(); NCONF_free(extconf); BIO_free_all(out); BIO_free_all(STDout); X509_STORE_free(ctx); X509_REQ_free(req); X509_free(x); X509_free(xca); EVP_PKEY_free(Upkey); EVP_PKEY_free(CApkey); EVP_PKEY_free(fkey); if (sigopts) sk_OPENSSL_STRING_free(sigopts); X509_REQ_free(rq); ASN1_INTEGER_free(sno); sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free); sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free); if (passin) OPENSSL_free(passin); apps_shutdown(); OPENSSL_EXIT(ret); } apps/x509.c:1129: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 204 could be null and is dereferenced by call to `X509_STORE_free()` at line 1129, column 2. Showing all 64 steps of the trace apps/x509.c:172:1: start of procedure x509_main() 170. int MAIN(int, char **); 171. 172. > int MAIN(int argc, char **argv) 173. { 174. ENGINE *e = NULL; apps/x509.c:174:2: 172. int MAIN(int argc, char **argv) 173. { 174. > ENGINE *e = NULL; 175. int ret=1; 176. X509_REQ *req=NULL; apps/x509.c:175:2: 173. { 174. ENGINE *e = NULL; 175. > int ret=1; 176. X509_REQ *req=NULL; 177. X509 *x=NULL,*xca=NULL; apps/x509.c:176:2: 174. ENGINE *e = NULL; 175. int ret=1; 176. > X509_REQ *req=NULL; 177. X509 *x=NULL,*xca=NULL; 178. ASN1_OBJECT *objtmp; apps/x509.c:177:2: 175. int ret=1; 176. X509_REQ *req=NULL; 177. > X509 *x=NULL,*xca=NULL; 178. ASN1_OBJECT *objtmp; 179. STACK_OF(OPENSSL_STRING) *sigopts = NULL; apps/x509.c:179:2: 177. X509 *x=NULL,*xca=NULL; 178. ASN1_OBJECT *objtmp; 179. > STACK_OF(OPENSSL_STRING) *sigopts = NULL; 180. EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL; 181. ASN1_INTEGER *sno = NULL; apps/x509.c:180:2: 178. ASN1_OBJECT *objtmp; 179. STACK_OF(OPENSSL_STRING) *sigopts = NULL; 180. > EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL; 181. ASN1_INTEGER *sno = NULL; 182. int i,num,badops=0; apps/x509.c:181:2: 179. STACK_OF(OPENSSL_STRING) *sigopts = NULL; 180. EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL; 181. > ASN1_INTEGER *sno = NULL; 182. int i,num,badops=0; 183. BIO *out=NULL; apps/x509.c:182:2: 180. EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL; 181. ASN1_INTEGER *sno = NULL; 182. > int i,num,badops=0; 183. BIO *out=NULL; 184. BIO *STDout=NULL; apps/x509.c:183:2: 181. ASN1_INTEGER *sno = NULL; 182. int i,num,badops=0; 183. > BIO *out=NULL; 184. BIO *STDout=NULL; 185. STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL; apps/x509.c:184:2: 182. int i,num,badops=0; 183. BIO *out=NULL; 184. > BIO *STDout=NULL; 185. STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL; 186. int informat,outformat,keyformat,CAformat,CAkeyformat; apps/x509.c:185:2: 183. BIO *out=NULL; 184. BIO *STDout=NULL; 185. > STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL; 186. int informat,outformat,keyformat,CAformat,CAkeyformat; 187. char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL; apps/x509.c:187:2: 185. STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL; 186. int informat,outformat,keyformat,CAformat,CAkeyformat; 187. > char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL; 188. char *CAkeyfile=NULL,*CAserial=NULL; 189. char *fkeyfile=NULL; apps/x509.c:188:2: 186. int informat,outformat,keyformat,CAformat,CAkeyformat; 187. char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL; 188. > char *CAkeyfile=NULL,*CAserial=NULL; 189. char *fkeyfile=NULL; 190. char *alias=NULL; apps/x509.c:189:2: 187. char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL; 188. char *CAkeyfile=NULL,*CAserial=NULL; 189. > char *fkeyfile=NULL; 190. char *alias=NULL; 191. int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0; apps/x509.c:190:2: 188. char *CAkeyfile=NULL,*CAserial=NULL; 189. char *fkeyfile=NULL; 190. > char *alias=NULL; 191. int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0; 192. int next_serial=0; apps/x509.c:191:2: 189. char *fkeyfile=NULL; 190. char *alias=NULL; 191. > int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0; 192. int next_serial=0; 193. int subject_hash=0,issuer_hash=0,ocspid=0; apps/x509.c:192:2: 190. char *alias=NULL; 191. int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0; 192. > int next_serial=0; 193. int subject_hash=0,issuer_hash=0,ocspid=0; 194. #ifndef OPENSSL_NO_MD5 apps/x509.c:193:2: 191. int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0; 192. int next_serial=0; 193. > int subject_hash=0,issuer_hash=0,ocspid=0; 194. #ifndef OPENSSL_NO_MD5 195. int subject_hash_old=0,issuer_hash_old=0; apps/x509.c:195:2: 193. int subject_hash=0,issuer_hash=0,ocspid=0; 194. #ifndef OPENSSL_NO_MD5 195. > int subject_hash_old=0,issuer_hash_old=0; 196. #endif 197. int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0; apps/x509.c:197:2: 195. int subject_hash_old=0,issuer_hash_old=0; 196. #endif 197. > int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0; 198. int ocsp_uri=0; 199. int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0; apps/x509.c:198:2: 196. #endif 197. int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0; 198. > int ocsp_uri=0; 199. int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0; 200. int C=0; apps/x509.c:199:2: 197. int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0; 198. int ocsp_uri=0; 199. > int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0; 200. int C=0; 201. int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0; apps/x509.c:200:2: 198. int ocsp_uri=0; 199. int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0; 200. > int C=0; 201. int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0; 202. int pprint = 0; apps/x509.c:201:2: 199. int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0; 200. int C=0; 201. > int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0; 202. int pprint = 0; 203. const char **pp; apps/x509.c:202:2: 200. int C=0; 201. int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0; 202. > int pprint = 0; 203. const char **pp; 204. X509_STORE *ctx=NULL; apps/x509.c:204:2: 202. int pprint = 0; 203. const char **pp; 204. > X509_STORE *ctx=NULL; 205. X509_REQ *rq=NULL; 206. int fingerprint=0; apps/x509.c:205:2: 203. const char **pp; 204. X509_STORE *ctx=NULL; 205. > X509_REQ *rq=NULL; 206. int fingerprint=0; 207. char buf[256]; apps/x509.c:206:2: 204. X509_STORE *ctx=NULL; 205. X509_REQ *rq=NULL; 206. > int fingerprint=0; 207. char buf[256]; 208. const EVP_MD *md_alg,*digest=NULL; apps/x509.c:208:2: 206. int fingerprint=0; 207. char buf[256]; 208. > const EVP_MD *md_alg,*digest=NULL; 209. CONF *extconf = NULL; 210. char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL; apps/x509.c:209:2: 207. char buf[256]; 208. const EVP_MD *md_alg,*digest=NULL; 209. > CONF *extconf = NULL; 210. char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL; 211. int need_rand = 0; apps/x509.c:210:2: 208. const EVP_MD *md_alg,*digest=NULL; 209. CONF *extconf = NULL; 210. > char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL; 211. int need_rand = 0; 212. int checkend=0,checkoffset=0; apps/x509.c:211:2: 209. CONF *extconf = NULL; 210. char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL; 211. > int need_rand = 0; 212. int checkend=0,checkoffset=0; 213. unsigned long nmflag = 0, certflag = 0; apps/x509.c:212:2: 210. char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL; 211. int need_rand = 0; 212. > int checkend=0,checkoffset=0; 213. unsigned long nmflag = 0, certflag = 0; 214. unsigned char *checkhost = NULL, *checkemail = NULL; apps/x509.c:213:2: 211. int need_rand = 0; 212. int checkend=0,checkoffset=0; 213. > unsigned long nmflag = 0, certflag = 0; 214. unsigned char *checkhost = NULL, *checkemail = NULL; 215. char *checkip = NULL; apps/x509.c:214:2: 212. int checkend=0,checkoffset=0; 213. unsigned long nmflag = 0, certflag = 0; 214. > unsigned char *checkhost = NULL, *checkemail = NULL; 215. char *checkip = NULL; 216. #ifndef OPENSSL_NO_ENGINE apps/x509.c:215:2: 213. unsigned long nmflag = 0, certflag = 0; 214. unsigned char *checkhost = NULL, *checkemail = NULL; 215. > char *checkip = NULL; 216. #ifndef OPENSSL_NO_ENGINE 217. char *engine=NULL; apps/x509.c:217:2: 215. char *checkip = NULL; 216. #ifndef OPENSSL_NO_ENGINE 217. > char *engine=NULL; 218. #endif 219. apps/x509.c:220:2: 218. #endif 219. 220. > reqfile=0; 221. 222. apps_startup(); apps/x509.c:222:2: 220. reqfile=0; 221. 222. > apps_startup(); 223. 224. if (bio_err == NULL) apps/x509.c:224:6: Taking false branch 222. apps_startup(); 223. 224. if (bio_err == NULL) ^ 225. bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); 226. apps/x509.c:227:7: Taking true branch 225. bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); 226. 227. if (!load_config(bio_err, NULL)) ^ 228. goto end; 229. STDout=BIO_new_fp(stdout,BIO_NOCLOSE); apps/x509.c:1122:1: 1120. } 1121. ret=0; 1122. > end: 1123. if (need_rand) 1124. app_RAND_write_file(NULL, bio_err); apps/x509.c:1123:6: Taking false branch 1121. ret=0; 1122. end: 1123. if (need_rand) ^ 1124. app_RAND_write_file(NULL, bio_err); 1125. OBJ_cleanup(); apps/x509.c:1125:2: 1123. if (need_rand) 1124. app_RAND_write_file(NULL, bio_err); 1125. > OBJ_cleanup(); 1126. NCONF_free(extconf); 1127. BIO_free_all(out); crypto/objects/obj_dat.c:222:1: start of procedure OBJ_cleanup() 220. } 221. 222. > void OBJ_cleanup(void) 223. { 224. if (obj_cleanup_defer) crypto/objects/obj_dat.c:224:6: Taking false branch 222. void OBJ_cleanup(void) 223. { 224. if (obj_cleanup_defer) ^ 225. { 226. obj_cleanup_defer = 2; crypto/objects/obj_dat.c:229:6: Taking true branch 227. return ; 228. } 229. if (added == NULL) return; ^ 230. lh_ADDED_OBJ_down_load(added) = 0; 231. lh_ADDED_OBJ_doall(added,LHASH_DOALL_FN(cleanup1)); /* zero counters */ crypto/objects/obj_dat.c:229:21: 227. return ; 228. } 229. > if (added == NULL) return; 230. lh_ADDED_OBJ_down_load(added) = 0; 231. lh_ADDED_OBJ_doall(added,LHASH_DOALL_FN(cleanup1)); /* zero counters */ crypto/objects/obj_dat.c:236:2: return from a call to OBJ_cleanup 234. lh_ADDED_OBJ_free(added); 235. added=NULL; 236. } ^ 237. 238. int OBJ_new_nid(int num) apps/x509.c:1126:2: 1124. app_RAND_write_file(NULL, bio_err); 1125. OBJ_cleanup(); 1126. > NCONF_free(extconf); 1127. BIO_free_all(out); 1128. BIO_free_all(STDout); crypto/conf/conf_lib.c:251:1: start of procedure NCONF_free() 249. } 250. 251. > void NCONF_free(CONF *conf) 252. { 253. if (conf == NULL) crypto/conf/conf_lib.c:253:6: Taking true branch 251. void NCONF_free(CONF *conf) 252. { 253. if (conf == NULL) ^ 254. return; 255. conf->meth->destroy(conf); crypto/conf/conf_lib.c:254:3: 252. { 253. if (conf == NULL) 254. > return; 255. conf->meth->destroy(conf); 256. } crypto/conf/conf_lib.c:256:2: return from a call to NCONF_free 254. return; 255. conf->meth->destroy(conf); 256. } ^ 257. 258. void NCONF_free_data(CONF *conf) apps/x509.c:1127:2: 1125. OBJ_cleanup(); 1126. NCONF_free(extconf); 1127. > BIO_free_all(out); 1128. BIO_free_all(STDout); 1129. X509_STORE_free(ctx); crypto/bio/bio_lib.c:506:1: start of procedure BIO_free_all() 504. } 505. 506. > void BIO_free_all(BIO *bio) 507. { 508. BIO *b; crypto/bio/bio_lib.c:511:9: Loop condition is false. Leaving loop 509. int ref; 510. 511. while (bio != NULL) ^ 512. { 513. b=bio; crypto/bio/bio_lib.c:520:2: return from a call to BIO_free_all 518. if (ref > 1) break; 519. } 520. } ^ 521. 522. BIO *BIO_dup_chain(BIO *in) apps/x509.c:1128:2: 1126. NCONF_free(extconf); 1127. BIO_free_all(out); 1128. > BIO_free_all(STDout); 1129. X509_STORE_free(ctx); 1130. X509_REQ_free(req); crypto/bio/bio_lib.c:506:1: start of procedure BIO_free_all() 504. } 505. 506. > void BIO_free_all(BIO *bio) 507. { 508. BIO *b; crypto/bio/bio_lib.c:511:9: Loop condition is false. Leaving loop 509. int ref; 510. 511. while (bio != NULL) ^ 512. { 513. b=bio; crypto/bio/bio_lib.c:520:2: return from a call to BIO_free_all 518. if (ref > 1) break; 519. } 520. } ^ 521. 522. BIO *BIO_dup_chain(BIO *in) apps/x509.c:1129:2: 1127. BIO_free_all(out); 1128. BIO_free_all(STDout); 1129. > X509_STORE_free(ctx); 1130. X509_REQ_free(req); 1131. X509_free(x);
https://github.com/openssl/openssl/blob/360ef6769e97f2918ae67a2909951eb8612043ee/apps/x509.c/#L1129
d2a_code_trace_data_45884
static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr, SpectrumParameters *spectrum) { unsigned int temp, max_qmf_subbands; unsigned int start_min, stop_min; int k; const int8_t *sbr_offset_ptr; int16_t stop_dk[13]; if (sbr->sample_rate < 32000) { temp = 3000; } else if (sbr->sample_rate < 64000) { temp = 4000; } else temp = 5000; start_min = ((temp << 7) + (sbr->sample_rate >> 1)) / sbr->sample_rate; stop_min = ((temp << 8) + (sbr->sample_rate >> 1)) / sbr->sample_rate; switch (sbr->sample_rate) { case 16000: sbr_offset_ptr = sbr_offset[0]; break; case 22050: sbr_offset_ptr = sbr_offset[1]; break; case 24000: sbr_offset_ptr = sbr_offset[2]; break; case 32000: sbr_offset_ptr = sbr_offset[3]; break; case 44100: case 48000: case 64000: sbr_offset_ptr = sbr_offset[4]; break; case 88200: case 96000: case 128000: case 176400: case 192000: sbr_offset_ptr = sbr_offset[5]; break; default: av_log(ac->avctx, AV_LOG_ERROR, "Unsupported sample rate for SBR: %d\n", sbr->sample_rate); return -1; } sbr->k[0] = start_min + sbr_offset_ptr[spectrum->bs_start_freq]; if (spectrum->bs_stop_freq < 14) { sbr->k[2] = stop_min; make_bands(stop_dk, stop_min, 64, 13); qsort(stop_dk, 13, sizeof(stop_dk[0]), qsort_comparison_function_int16); for (k = 0; k < spectrum->bs_stop_freq; k++) sbr->k[2] += stop_dk[k]; } else if (spectrum->bs_stop_freq == 14) { sbr->k[2] = 2*sbr->k[0]; } else if (spectrum->bs_stop_freq == 15) { sbr->k[2] = 3*sbr->k[0]; } else { av_log(ac->avctx, AV_LOG_ERROR, "Invalid bs_stop_freq: %d\n", spectrum->bs_stop_freq); return -1; } sbr->k[2] = FFMIN(64, sbr->k[2]); if (sbr->sample_rate <= 32000) { max_qmf_subbands = 48; } else if (sbr->sample_rate == 44100) { max_qmf_subbands = 35; } else if (sbr->sample_rate >= 48000) max_qmf_subbands = 32; if (sbr->k[2] - sbr->k[0] > max_qmf_subbands) { av_log(ac->avctx, AV_LOG_ERROR, "Invalid bitstream, too many QMF subbands: %d\n", sbr->k[2] - sbr->k[0]); return -1; } if (!spectrum->bs_freq_scale) { int dk, k2diff; dk = spectrum->bs_alter_scale + 1; sbr->n_master = ((sbr->k[2] - sbr->k[0] + (dk&2)) >> dk) << 1; if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band)) return -1; for (k = 1; k <= sbr->n_master; k++) sbr->f_master[k] = dk; k2diff = sbr->k[2] - sbr->k[0] - sbr->n_master * dk; if (k2diff < 0) { sbr->f_master[1]--; sbr->f_master[2]-= (k2diff < -1); } else if (k2diff) { sbr->f_master[sbr->n_master]++; } sbr->f_master[0] = sbr->k[0]; for (k = 1; k <= sbr->n_master; k++) sbr->f_master[k] += sbr->f_master[k - 1]; } else { int half_bands = 7 - spectrum->bs_freq_scale; int two_regions, num_bands_0; int vdk0_max, vdk1_min; int16_t vk0[49]; if (49 * sbr->k[2] > 110 * sbr->k[0]) { two_regions = 1; sbr->k[1] = 2 * sbr->k[0]; } else { two_regions = 0; sbr->k[1] = sbr->k[2]; } num_bands_0 = lrintf(half_bands * log2f(sbr->k[1] / (float)sbr->k[0])) * 2; if (num_bands_0 <= 0) { av_log(ac->avctx, AV_LOG_ERROR, "Invalid num_bands_0: %d\n", num_bands_0); return -1; } vk0[0] = 0; make_bands(vk0+1, sbr->k[0], sbr->k[1], num_bands_0); qsort(vk0 + 1, num_bands_0, sizeof(vk0[1]), qsort_comparison_function_int16); vdk0_max = vk0[num_bands_0]; vk0[0] = sbr->k[0]; for (k = 1; k <= num_bands_0; k++) { if (vk0[k] <= 0) { av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk0[%d]: %d\n", k, vk0[k]); return -1; } vk0[k] += vk0[k-1]; } if (two_regions) { int16_t vk1[49]; float invwarp = spectrum->bs_alter_scale ? 0.76923076923076923077f : 1.0f; int num_bands_1 = lrintf(half_bands * invwarp * log2f(sbr->k[2] / (float)sbr->k[1])) * 2; make_bands(vk1+1, sbr->k[1], sbr->k[2], num_bands_1); vdk1_min = array_min_int16(vk1 + 1, num_bands_1); if (vdk1_min < vdk0_max) { int change; qsort(vk1 + 1, num_bands_1, sizeof(vk1[1]), qsort_comparison_function_int16); change = FFMIN(vdk0_max - vk1[1], (vk1[num_bands_1] - vk1[1]) >> 1); vk1[1] += change; vk1[num_bands_1] -= change; } qsort(vk1 + 1, num_bands_1, sizeof(vk1[1]), qsort_comparison_function_int16); vk1[0] = sbr->k[1]; for (k = 1; k <= num_bands_1; k++) { if (vk1[k] <= 0) { av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk1[%d]: %d\n", k, vk1[k]); return -1; } vk1[k] += vk1[k-1]; } sbr->n_master = num_bands_0 + num_bands_1; if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band)) return -1; memcpy(&sbr->f_master[0], vk0, (num_bands_0 + 1) * sizeof(sbr->f_master[0])); memcpy(&sbr->f_master[num_bands_0 + 1], vk1 + 1, num_bands_1 * sizeof(sbr->f_master[0])); } else { sbr->n_master = num_bands_0; if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band)) return -1; memcpy(sbr->f_master, vk0, (num_bands_0 + 1) * sizeof(sbr->f_master[0])); } } return 0; } libavcodec/aacdec.c:2139: error: Integer Overflow L2 ([0, +oo] - 1):unsigned16 by call to `decode_extension_payload`. libavcodec/aacdec.c:2072:13: Call 2070. 2071. if (show_bits(gb, 12) == 0xfff) { 2072. if (parse_adts_frame_header(ac, gb) < 0) { ^ 2073. av_log(avctx, AV_LOG_ERROR, "Error decoding AAC frame header.\n"); 2074. return -1; libavcodec/aacdec.c:2024:1: Parameter `ac->avctx->sample_rate` 2022. } 2023. 2024. static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb) ^ 2025. { 2026. int size; libavcodec/aacdec.c:2139:28: Call 2137. } 2138. while (elem_id > 0) 2139. elem_id -= decode_extension_payload(ac, gb, elem_id, che_prev, elem_type_prev); ^ 2140. err = 0; /* FIXME */ 2141. break; libavcodec/aacdec.c:1629:1: Parameter `che->sbr.f_master[*]` 1627. * @return Returns number of bytes consumed 1628. */ 1629. static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt, ^ 1630. ChannelElement *che, enum RawDataBlockType elem_type) 1631. { libavcodec/aacdec.c:1656:15: Call 1654. ac->m4ac.sbr = 1; 1655. } 1656. res = ff_decode_sbr_extension(ac, &che->sbr, gb, crc_flag, cnt, elem_type); ^ 1657. break; 1658. case EXT_DYNAMIC_RANGE: libavcodec/aacsbr.c:1044:1: Parameter `sbr->f_master[*]` 1042. * @return Returns number of bytes consumed from the TYPE_FIL element. 1043. */ 1044. int ff_decode_sbr_extension(AACContext *ac, SpectralBandReplication *sbr, ^ 1045. GetBitContext *gb_host, int crc, int cnt, int id_aac) 1046. { libavcodec/aacsbr.c:1073:9: Call 1071. 1072. if (sbr->reset) 1073. sbr_reset(ac, sbr); ^ 1074. 1075. if (sbr->start) libavcodec/aacsbr.c:1023:1: Parameter `sbr->f_master[*]` 1021. } 1022. 1023. static void sbr_reset(AACContext *ac, SpectralBandReplication *sbr) ^ 1024. { 1025. int err; libavcodec/aacsbr.c:1026:11: Call 1024. { 1025. int err; 1026. err = sbr_make_f_master(ac, sbr, &sbr->spectrum_params); ^ 1027. if (err >= 0) 1028. err = sbr_make_f_derived(ac, sbr); libavcodec/aacsbr.c:304:1: <LHS trace> 302. 303. /// Master Frequency Band Table (14496-3 sp04 p194) 304. static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr, ^ 305. SpectrumParameters *spectrum) 306. { libavcodec/aacsbr.c:304:1: Parameter `sbr->f_master[*]` 302. 303. /// Master Frequency Band Table (14496-3 sp04 p194) 304. static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr, ^ 305. SpectrumParameters *spectrum) 306. { libavcodec/aacsbr.c:394:13: Binary operation: ([0, +oo] - 1):unsigned16 by call to `decode_extension_payload` 392. k2diff = sbr->k[2] - sbr->k[0] - sbr->n_master * dk; 393. if (k2diff < 0) { 394. sbr->f_master[1]--; ^ 395. sbr->f_master[2]-= (k2diff < -1); 396. } else if (k2diff) {
https://github.com/libav/libav/blob/1c69c79f2b11627cb50f1bc571de97ad8cbfefb7/libavcodec/aacsbr.c/#L394
d2a_code_trace_data_45885
void *lh_delete(_LHASH *lh, const void *data) { unsigned long hash; LHASH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } test/danetest.c:394: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_free`. Showing all 20 steps of the trace test/danetest.c:390:20: Call 388. } 389. 390. if ((ssl = SSL_new(ctx)) == NULL) ^ 391. return -1; 392. SSL_set_connect_state(ssl); ssl/ssl_lib.c:614:1: Parameter `ctx->sessions->num_items` 612. } 613. 614. > SSL *SSL_new(SSL_CTX *ctx) 615. { 616. SSL *s; test/danetest.c:425:9: Call 423. /* Not needed any more, but lead by example and put the error back. */ 424. SSL_set_verify_result(ssl, err); 425. SSL_free(ssl); ^ 426. 427. if (ok < 0) { ssl/ssl_lib.c:990:1: Parameter `s->ctx->sessions->num_items` 988. } 989. 990. > void SSL_free(SSL *s) 991. { 992. int i; test/danetest.c:390:20: Call 388. } 389. 390. if ((ssl = SSL_new(ctx)) == NULL) ^ 391. return -1; 392. SSL_set_connect_state(ssl); ssl/ssl_lib.c:614:1: Parameter `ctx->sessions->num_items` 612. } 613. 614. > SSL *SSL_new(SSL_CTX *ctx) 615. { 616. SSL *s; test/danetest.c:394:13: Call 392. SSL_set_connect_state(ssl); 393. if (SSL_dane_enable(ssl, basename) <= 0) { 394. SSL_free(ssl); ^ 395. return -1; 396. } ssl/ssl_lib.c:990:1: Parameter `s->ctx->sessions->num_items` 988. } 989. 990. > void SSL_free(SSL *s) 991. { 992. int i; ssl/ssl_lib.c:1034:9: Call 1032. /* Make the next call work :-) */ 1033. if (s->session != NULL) { 1034. ssl_clear_bad_session(s); ^ 1035. SSL_SESSION_free(s->session); 1036. } ssl/ssl_sess.c:1074:1: Parameter `s->ctx->sessions->num_items` 1072. } 1073. 1074. > int ssl_clear_bad_session(SSL *s) 1075. { 1076. if ((s->session != NULL) && ssl/ssl_sess.c:1079:9: Call 1077. !(s->shutdown & SSL_SENT_SHUTDOWN) && 1078. !(SSL_in_init(s) || SSL_in_before(s))) { 1079. SSL_CTX_remove_session(s->ctx, s->session); ^ 1080. return (1); 1081. } else ssl/ssl_sess.c:776:1: Parameter `ctx->sessions->num_items` 774. } 775. 776. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 777. { 778. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:778:12: Call 776. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 777. { 778. return remove_session_lock(ctx, c, 1); ^ 779. } 780. ssl/ssl_sess.c:781:1: Parameter `ctx->sessions->num_items` 779. } 780. 781. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 782. { 783. SSL_SESSION *r; ssl/ssl_sess.c:791:17: Call 789. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 790. ret = 1; 791. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 792. SSL_SESSION_list_remove(ctx, c); 793. } ssl/ssl_locl.h:686:1: Parameter `lh->num_items` 684. }; 685. 686. > DEFINE_LHASH_OF(SSL_SESSION); 687. 688. ssl/ssl_locl.h:686:1: Call 684. }; 685. 686. > DEFINE_LHASH_OF(SSL_SESSION); 687. 688. crypto/lhash/lhash.c:188:1: <LHS trace> 186. } 187. 188. > void *lh_delete(_LHASH *lh, const void *data) 189. { 190. unsigned long hash; crypto/lhash/lhash.c:188:1: Parameter `lh->num_items` 186. } 187. 188. > void *lh_delete(_LHASH *lh, const void *data) 189. { 190. unsigned long hash; crypto/lhash/lhash.c:208:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free` 206. } 207. 208. lh->num_items--; ^ 209. if ((lh->num_nodes > MIN_NODES) && 210. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/0fd2d5fa3c58e0a11f059becd1fcf063c05ea292/crypto/lhash/lhash.c/#L208
d2a_code_trace_data_45886
static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code) { AVFormatContext *s = nut->avf; AVIOContext *bc = s->pb; int size, stream_id, discard; int64_t pts, last_IP_pts; StreamContext *stc; uint8_t header_idx; size = decode_frame_header(nut, &pts, &stream_id, &header_idx, frame_code); if (size < 0) return size; stc = &nut->stream[stream_id]; if (stc->last_flags & FLAG_KEY) stc->skip_until_key_frame = 0; discard = s->streams[stream_id]->discard; last_IP_pts = s->streams[stream_id]->last_IP_pts; if ((discard >= AVDISCARD_NONKEY && !(stc->last_flags & FLAG_KEY)) || (discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts) || discard >= AVDISCARD_ALL || stc->skip_until_key_frame) { avio_skip(bc, size); return 1; } av_new_packet(pkt, size + nut->header_len[header_idx]); memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]); pkt->pos = avio_tell(bc); avio_read(bc, pkt->data + nut->header_len[header_idx], size); pkt->stream_index = stream_id; if (stc->last_flags & FLAG_KEY) pkt->flags |= AV_PKT_FLAG_KEY; pkt->pts = pts; return 0; } libavformat/nutdec.c:815: error: Null Dereference pointer `pkt->data` last assigned on line 814 could be null and is dereferenced by call to `memcpy()` at line 815, column 5. libavformat/nutdec.c:785:1: start of procedure decode_frame() 783. } 784. 785. static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code) ^ 786. { 787. AVFormatContext *s = nut->avf; libavformat/nutdec.c:787:5: 785. static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code) 786. { 787. AVFormatContext *s = nut->avf; ^ 788. AVIOContext *bc = s->pb; 789. int size, stream_id, discard; libavformat/nutdec.c:788:5: 786. { 787. AVFormatContext *s = nut->avf; 788. AVIOContext *bc = s->pb; ^ 789. int size, stream_id, discard; 790. int64_t pts, last_IP_pts; libavformat/nutdec.c:794:5: Skipping decode_frame_header(): empty list of specs 792. uint8_t header_idx; 793. 794. size = decode_frame_header(nut, &pts, &stream_id, &header_idx, frame_code); ^ 795. if (size < 0) 796. return size; libavformat/nutdec.c:795:9: Taking false branch 793. 794. size = decode_frame_header(nut, &pts, &stream_id, &header_idx, frame_code); 795. if (size < 0) ^ 796. return size; 797. libavformat/nutdec.c:798:5: 796. return size; 797. 798. stc = &nut->stream[stream_id]; ^ 799. 800. if (stc->last_flags & FLAG_KEY) libavformat/nutdec.c:800:9: Taking true branch 798. stc = &nut->stream[stream_id]; 799. 800. if (stc->last_flags & FLAG_KEY) ^ 801. stc->skip_until_key_frame = 0; 802. libavformat/nutdec.c:801:9: 799. 800. if (stc->last_flags & FLAG_KEY) 801. stc->skip_until_key_frame = 0; ^ 802. 803. discard = s->streams[stream_id]->discard; libavformat/nutdec.c:803:5: 801. stc->skip_until_key_frame = 0; 802. 803. discard = s->streams[stream_id]->discard; ^ 804. last_IP_pts = s->streams[stream_id]->last_IP_pts; 805. if ((discard >= AVDISCARD_NONKEY && !(stc->last_flags & FLAG_KEY)) || libavformat/nutdec.c:804:5: 802. 803. discard = s->streams[stream_id]->discard; 804. last_IP_pts = s->streams[stream_id]->last_IP_pts; ^ 805. if ((discard >= AVDISCARD_NONKEY && !(stc->last_flags & FLAG_KEY)) || 806. (discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && libavformat/nutdec.c:805:10: Taking false branch 803. discard = s->streams[stream_id]->discard; 804. last_IP_pts = s->streams[stream_id]->last_IP_pts; 805. if ((discard >= AVDISCARD_NONKEY && !(stc->last_flags & FLAG_KEY)) || ^ 806. (discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && 807. last_IP_pts > pts) || libavformat/nutdec.c:806:10: Taking true branch 804. last_IP_pts = s->streams[stream_id]->last_IP_pts; 805. if ((discard >= AVDISCARD_NONKEY && !(stc->last_flags & FLAG_KEY)) || 806. (discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && ^ 807. last_IP_pts > pts) || 808. discard >= AVDISCARD_ALL || libavformat/nutdec.c:806:41: Taking true branch 804. last_IP_pts = s->streams[stream_id]->last_IP_pts; 805. if ((discard >= AVDISCARD_NONKEY && !(stc->last_flags & FLAG_KEY)) || 806. (discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && ^ 807. last_IP_pts > pts) || 808. discard >= AVDISCARD_ALL || libavformat/nutdec.c:807:10: Taking false branch 805. if ((discard >= AVDISCARD_NONKEY && !(stc->last_flags & FLAG_KEY)) || 806. (discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && 807. last_IP_pts > pts) || ^ 808. discard >= AVDISCARD_ALL || 809. stc->skip_until_key_frame) { libavformat/nutdec.c:808:9: Taking false branch 806. (discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && 807. last_IP_pts > pts) || 808. discard >= AVDISCARD_ALL || ^ 809. stc->skip_until_key_frame) { 810. avio_skip(bc, size); libavformat/nutdec.c:809:9: Taking false branch 807. last_IP_pts > pts) || 808. discard >= AVDISCARD_ALL || 809. stc->skip_until_key_frame) { ^ 810. avio_skip(bc, size); 811. return 1; libavformat/nutdec.c:814:5: 812. } 813. 814. av_new_packet(pkt, size + nut->header_len[header_idx]); ^ 815. memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]); 816. pkt->pos = avio_tell(bc); // FIXME libavcodec/avpacket.c:56:1: start of procedure av_new_packet() 54. } 55. 56. int av_new_packet(AVPacket *pkt, int size) ^ 57. { 58. uint8_t *data = NULL; libavcodec/avpacket.c:58:5: 56. int av_new_packet(AVPacket *pkt, int size) 57. { 58. uint8_t *data = NULL; ^ 59. if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) 60. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); libavcodec/avpacket.c:59:9: Taking true branch 57. { 58. uint8_t *data = NULL; 59. if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) ^ 60. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); 61. if (data) { libavcodec/avpacket.c:60:9: 58. uint8_t *data = NULL; 59. if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) 60. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); ^ 61. if (data) { 62. memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:9: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if (size > (INT_MAX-32) || !size) ^ 73. return NULL; 74. libavutil/mem.c:72:33: Taking true branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if (size > (INT_MAX-32) || !size) ^ 73. return NULL; 74. libavutil/mem.c:73:9: 71. /* let's disallow possible ambiguous cases */ 72. if (size > (INT_MAX-32) || !size) 73. return NULL; ^ 74. 75. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:117:1: return from a call to av_malloc 115. #endif 116. return ptr; 117. } ^ 118. 119. void *av_realloc(void *ptr, size_t size) libavcodec/avpacket.c:61:9: Taking false branch 59. if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) 60. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); 61. if (data) { ^ 62. memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); 63. } else libavcodec/avpacket.c:64:9: 62. memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); 63. } else 64. size = 0; ^ 65. 66. av_init_packet(pkt); libavcodec/avpacket.c:66:5: 64. size = 0; 65. 66. av_init_packet(pkt); ^ 67. pkt->data = data; 68. pkt->size = size; libavcodec/avpacket.c:42:1: start of procedure av_init_packet() 40. } 41. 42. void av_init_packet(AVPacket *pkt) ^ 43. { 44. pkt->pts = AV_NOPTS_VALUE; libavcodec/avpacket.c:44:5: 42. void av_init_packet(AVPacket *pkt) 43. { 44. pkt->pts = AV_NOPTS_VALUE; ^ 45. pkt->dts = AV_NOPTS_VALUE; 46. pkt->pos = -1; libavcodec/avpacket.c:45:5: 43. { 44. pkt->pts = AV_NOPTS_VALUE; 45. pkt->dts = AV_NOPTS_VALUE; ^ 46. pkt->pos = -1; 47. pkt->duration = 0; libavcodec/avpacket.c:46:5: 44. pkt->pts = AV_NOPTS_VALUE; 45. pkt->dts = AV_NOPTS_VALUE; 46. pkt->pos = -1; ^ 47. pkt->duration = 0; 48. pkt->convergence_duration = 0; libavcodec/avpacket.c:47:5: 45. pkt->dts = AV_NOPTS_VALUE; 46. pkt->pos = -1; 47. pkt->duration = 0; ^ 48. pkt->convergence_duration = 0; 49. pkt->flags = 0; libavcodec/avpacket.c:48:5: 46. pkt->pos = -1; 47. pkt->duration = 0; 48. pkt->convergence_duration = 0; ^ 49. pkt->flags = 0; 50. pkt->stream_index = 0; libavcodec/avpacket.c:49:5: 47. pkt->duration = 0; 48. pkt->convergence_duration = 0; 49. pkt->flags = 0; ^ 50. pkt->stream_index = 0; 51. pkt->destruct = NULL; libavcodec/avpacket.c:50:5: 48. pkt->convergence_duration = 0; 49. pkt->flags = 0; 50. pkt->stream_index = 0; ^ 51. pkt->destruct = NULL; 52. pkt->side_data = NULL; libavcodec/avpacket.c:51:5: 49. pkt->flags = 0; 50. pkt->stream_index = 0; 51. pkt->destruct = NULL; ^ 52. pkt->side_data = NULL; 53. pkt->side_data_elems = 0; libavcodec/avpacket.c:52:5: 50. pkt->stream_index = 0; 51. pkt->destruct = NULL; 52. pkt->side_data = NULL; ^ 53. pkt->side_data_elems = 0; 54. } libavcodec/avpacket.c:53:5: 51. pkt->destruct = NULL; 52. pkt->side_data = NULL; 53. pkt->side_data_elems = 0; ^ 54. } 55. libavcodec/avpacket.c:54:1: return from a call to av_init_packet 52. pkt->side_data = NULL; 53. pkt->side_data_elems = 0; 54. } ^ 55. 56. int av_new_packet(AVPacket *pkt, int size) libavcodec/avpacket.c:67:5: 65. 66. av_init_packet(pkt); 67. pkt->data = data; ^ 68. pkt->size = size; 69. pkt->destruct = av_destruct_packet; libavcodec/avpacket.c:68:5: 66. av_init_packet(pkt); 67. pkt->data = data; 68. pkt->size = size; ^ 69. pkt->destruct = av_destruct_packet; 70. if (!data) libavcodec/avpacket.c:69:5: 67. pkt->data = data; 68. pkt->size = size; 69. pkt->destruct = av_destruct_packet; ^ 70. if (!data) 71. return AVERROR(ENOMEM); libavcodec/avpacket.c:70:10: Taking true branch 68. pkt->size = size; 69. pkt->destruct = av_destruct_packet; 70. if (!data) ^ 71. return AVERROR(ENOMEM); 72. return 0; libavcodec/avpacket.c:71:9: 69. pkt->destruct = av_destruct_packet; 70. if (!data) 71. return AVERROR(ENOMEM); ^ 72. return 0; 73. } libavcodec/avpacket.c:73:1: return from a call to av_new_packet 71. return AVERROR(ENOMEM); 72. return 0; 73. } ^ 74. 75. void av_shrink_packet(AVPacket *pkt, int size) libavformat/nutdec.c:815:5: 813. 814. av_new_packet(pkt, size + nut->header_len[header_idx]); 815. memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]); ^ 816. pkt->pos = avio_tell(bc); // FIXME 817. avio_read(bc, pkt->data + nut->header_len[header_idx], size);
https://github.com/libav/libav/blob/92281850a2d878dae1d50e271886ba87013b6ff3/libavformat/nutdec.c/#L815
d2a_code_trace_data_45887
static int dnxhd_init_rc(DNXHDEncContext *ctx) { CHECKED_ALLOCZ(ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry)); if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD) CHECKED_ALLOCZ(ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry)); ctx->frame_bits = (ctx->cid_table->coding_unit_size - 640 - 4) * 8; ctx->qscale = 1; ctx->lambda = 2<<LAMBDA_FRAC_BITS; return 0; fail: return -1; } libavcodec/dnxhdenc.c:210: error: Integer Overflow L2 ([0, +oo] - 640):unsigned32 by call to `dnxhd_init_rc`. libavcodec/dnxhdenc.c:188:5: Call 186. ctx->m.h263_aic = 1; 187. 188. dsputil_init(&ctx->m.dsp, avctx); ^ 189. ff_dct_common_init(&ctx->m); 190. if (!ctx->m.dct_quantize) libavcodec/dsputil.c:4115:1: Parameter `c->idct_permutation[*]` 4113. } 4114. 4115. void dsputil_init(DSPContext* c, AVCodecContext *avctx) ^ 4116. { 4117. int i; libavcodec/dnxhdenc.c:189:5: Call 187. 188. dsputil_init(&ctx->m.dsp, avctx); 189. ff_dct_common_init(&ctx->m); ^ 190. if (!ctx->m.dct_quantize) 191. ctx->m.dct_quantize = dct_quantize_c; libavcodec/mpegvideo.c:113:1: Parameter `s->intra_v_scantable.raster_end[*].*.strlen` 111. 112. /* init common dct for both encoder and decoder */ 113. int ff_dct_common_init(MpegEncContext *s) ^ 114. { 115. s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_c; libavcodec/mpegvideo.c:151:5: Call 149. } 150. ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan); 151. ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan); ^ 152. 153. return 0; libavcodec/dsputil.c:154:1: Parameter `st->raster_end[*]` 152. }; 153. 154. void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable){ ^ 155. int i; 156. int end; libavcodec/dnxhdenc.c:205:9: Call 203. if (avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS) 204. ctx->m.intra_quant_bias = avctx->intra_quant_bias; 205. if (dnxhd_init_qmat(ctx, ctx->m.intra_quant_bias, 0) < 0) // XXX tune lbias/cbias ^ 206. return -1; 207. libavcodec/dnxhdenc.c:120:1: Parameter `ctx->m.dsp.idct_permutation[*]` 118. } 119. 120. static int dnxhd_init_qmat(DNXHDEncContext *ctx, int lbias, int cbias) ^ 121. { 122. // init first elem to 1 to avoid div by 0 in convert_matrix libavcodec/dnxhdenc.c:208:9: Call 206. return -1; 207. 208. if (dnxhd_init_vlc(ctx) < 0) ^ 209. return -1; 210. if (dnxhd_init_rc(ctx) < 0) libavcodec/dnxhdenc.c:91:1: Parameter `*ctx->cid_table->run_codes` 89. #define LAMBDA_FRAC_BITS 10 90. 91. static int dnxhd_init_vlc(DNXHDEncContext *ctx) ^ 92. { 93. int i; libavcodec/dnxhdenc.c:210:9: Call 208. if (dnxhd_init_vlc(ctx) < 0) 209. return -1; 210. if (dnxhd_init_rc(ctx) < 0) ^ 211. return -1; 212. libavcodec/dnxhdenc.c:155:1: <LHS trace> 153. } 154. 155. static int dnxhd_init_rc(DNXHDEncContext *ctx) ^ 156. { 157. CHECKED_ALLOCZ(ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry)); libavcodec/dnxhdenc.c:155:1: Parameter `ctx->cid_table->coding_unit_size` 153. } 154. 155. static int dnxhd_init_rc(DNXHDEncContext *ctx) ^ 156. { 157. CHECKED_ALLOCZ(ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry)); libavcodec/dnxhdenc.c:161:5: Binary operation: ([0, +oo] - 640):unsigned32 by call to `dnxhd_init_rc` 159. CHECKED_ALLOCZ(ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry)); 160. 161. ctx->frame_bits = (ctx->cid_table->coding_unit_size - 640 - 4) * 8; ^ 162. ctx->qscale = 1; 163. ctx->lambda = 2<<LAMBDA_FRAC_BITS; // qscale 2
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dnxhdenc.c/#L161
d2a_code_trace_data_45888
static EVP_PKEY *do_PVK_body(const unsigned char **in, unsigned int saltlen, unsigned int keylen, pem_password_cb *cb, void *u) { EVP_PKEY *ret = NULL; const unsigned char *p = *in; unsigned int magic; unsigned char *enctmp = NULL, *q; EVP_CIPHER_CTX cctx; EVP_CIPHER_CTX_init(&cctx); if (saltlen) { char psbuf[PEM_BUFSIZE]; unsigned char keybuf[20]; int enctmplen, inlen; if (cb) inlen=cb(psbuf,PEM_BUFSIZE,0,u); else inlen=PEM_def_callback(psbuf,PEM_BUFSIZE,0,u); if (inlen <= 0) { PEMerr(PEM_F_DO_PVK_BODY,PEM_R_BAD_PASSWORD_READ); return NULL; } enctmp = OPENSSL_malloc(keylen + 8); if (!enctmp) { PEMerr(PEM_F_DO_PVK_BODY, ERR_R_MALLOC_FAILURE); return NULL; } if (!derive_pvk_key(keybuf, p, saltlen, (unsigned char *)psbuf, inlen)) return NULL; p += saltlen; memcpy(enctmp, p, 8); p += 8; inlen = keylen - 8; q = enctmp + 8; if (!EVP_DecryptInit_ex(&cctx, EVP_rc4(), NULL, keybuf, NULL)) goto err; if (!EVP_DecryptUpdate(&cctx, q, &enctmplen, p, inlen)) goto err; if (!EVP_DecryptFinal_ex(&cctx, q + enctmplen, &enctmplen)) goto err; magic = read_ledword((const unsigned char **)&q); if (magic != MS_RSA2MAGIC && magic != MS_DSS2MAGIC) { q = enctmp + 8; memset(keybuf + 5, 0, 11); if (!EVP_DecryptInit_ex(&cctx, EVP_rc4(), NULL, keybuf, NULL)) goto err; OPENSSL_cleanse(keybuf, 20); if (!EVP_DecryptUpdate(&cctx, q, &enctmplen, p, inlen)) goto err; if (!EVP_DecryptFinal_ex(&cctx, q + enctmplen, &enctmplen)) goto err; magic = read_ledword((const unsigned char **)&q); if (magic != MS_RSA2MAGIC && magic != MS_DSS2MAGIC) { PEMerr(PEM_F_DO_PVK_BODY, PEM_R_BAD_DECRYPT); goto err; } } else OPENSSL_cleanse(keybuf, 20); p = enctmp; } ret = b2i_PrivateKey(&p, keylen); err: EVP_CIPHER_CTX_cleanup(&cctx); if (enctmp && saltlen) OPENSSL_free(enctmp); return ret; } crypto/pem/pvkfmt.c:834: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 8):unsigned32 by call to `do_PVK_body`. Showing all 6 steps of the trace crypto/pem/pvkfmt.c:819:7: Call 817. p = pvk_hdr; 818. 819. if (!do_PVK_header(&p, 24, 0, &saltlen, &keylen)) ^ 820. return 0; 821. buflen = (int) keylen + saltlen; crypto/pem/pvkfmt.c:659:1: Parameter `*pkeylen` 657. #ifndef OPENSSL_NO_RC4 658. 659. > static int do_PVK_header(const unsigned char **in, unsigned int length, 660. int skip_magic, 661. unsigned int *psaltlen, unsigned int *pkeylen) crypto/pem/pvkfmt.c:834:8: Call 832. goto err; 833. } 834. ret = do_PVK_body(&p, saltlen, keylen, cb, u); ^ 835. 836. err: crypto/pem/pvkfmt.c:725:1: <LHS trace> 723. 724. 725. > static EVP_PKEY *do_PVK_body(const unsigned char **in, 726. unsigned int saltlen, unsigned int keylen, 727. pem_password_cb *cb, void *u) crypto/pem/pvkfmt.c:725:1: Parameter `keylen` 723. 724. 725. > static EVP_PKEY *do_PVK_body(const unsigned char **in, 726. unsigned int saltlen, unsigned int keylen, 727. pem_password_cb *cb, void *u) crypto/pem/pvkfmt.c:762:3: Binary operation: ([0, +oo] - 8):unsigned32 by call to `do_PVK_body` 760. memcpy(enctmp, p, 8); 761. p += 8; 762. inlen = keylen - 8; ^ 763. q = enctmp + 8; 764. if (!EVP_DecryptInit_ex(&cctx, EVP_rc4(), NULL, keybuf, NULL))
https://github.com/openssl/openssl/blob/00a37b5a9b295c1b55ca9a1c1f207d347ad5b24a/crypto/pem/pvkfmt.c/#L762
d2a_code_trace_data_45889
static inline uint64_t get_val(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1); bc->bits >>= n; #else uint64_t ret = bc->bits >> (64 - n); bc->bits <<= n; #endif bc->bits_left -= n; return ret; } libavcodec/wavpack.c:628: error: Integer Overflow L2 ([-1, +oo] - 1):unsigned32 by call to `wv_get_value_float`. libavcodec/wavpack.c:530:1: Parameter `s->bc_extra_bits.bits_left` 528. } 529. 530. static inline int wv_unpack_stereo(WavpackFrameContext *s, BitstreamContext *bc, ^ 531. void *dst_l, void *dst_r, const int type) 532. { libavcodec/wavpack.c:628:26: Call 626. 627. if (type == AV_SAMPLE_FMT_FLTP) { 628. *dstfl_l++ = wv_get_value_float(s, &crc_extra_bits, L); ^ 629. *dstfl_r++ = wv_get_value_float(s, &crc_extra_bits, R); 630. } else if (type == AV_SAMPLE_FMT_S32P) { libavcodec/wavpack.c:435:1: Parameter `s->bc_extra_bits.bits_left` 433. } 434. 435. static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S) ^ 436. { 437. union { libavcodec/wavpack.c:491:17: Call 489. exp = 0; 490. if (s->got_extra_bits && (s->float_flag & WV_FLT_ZERO_SENT)) { 491. if (bitstream_read_bit(&s->bc_extra_bits)) { ^ 492. S = bitstream_read(&s->bc_extra_bits, 23); 493. if (s->float_max_exp >= 25) libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Assignment 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret; libavcodec/wavpack.c:498:28: Call 496. } else { 497. if (s->float_flag & WV_FLT_ZERO_SIGN) 498. sign = bitstream_read_bit(&s->bc_extra_bits); ^ 499. } 500. } libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([-1, +oo] - 1):unsigned32 by call to `wv_get_value_float` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139
d2a_code_trace_data_45890
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/bn/bn_exp.c:1345: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_mul`. Showing all 31 steps of the trace crypto/bn/bn_exp.c:1345:22: Call 1343. if (BN_is_bit_set(p, wstart) == 0) { 1344. if (!start) 1345. if (!BN_mod_mul(r, r, r, m, ctx)) ^ 1346. goto err; 1347. if (wstart == 0) crypto/bn/bn_mod.c:193:1: Parameter `r->top` 191. 192. /* slow but works */ 193. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 194. BN_CTX *ctx) 195. { crypto/bn/bn_exp.c:1345:22: Call 1343. if (BN_is_bit_set(p, wstart) == 0) { 1344. if (!start) 1345. if (!BN_mod_mul(r, r, r, m, ctx)) ^ 1346. goto err; 1347. if (wstart == 0) crypto/bn/bn_mod.c:193:1: Parameter `r->top` 191. 192. /* slow but works */ 193. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 194. BN_CTX *ctx) 195. { crypto/bn/bn_mod.c:213:10: Call 211. goto err; 212. } 213. if (!BN_nnmod(r, t, m, ctx)) ^ 214. goto err; 215. bn_check_top(r); crypto/bn/bn_mod.c:13:1: Parameter `r->top` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:209:1: Parameter `rm->top` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:264:1: Parameter `rm->top` 262. * divisor's length is considered public; 263. */ 264. > int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, 265. const BIGNUM *divisor, BN_CTX *ctx) 266. { crypto/bn/bn_div.c:449:9: Call 447. snum->flags |= BN_FLG_FIXED_TOP; 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); ^ 450. BN_CTX_end(ctx); 451. return 1; crypto/bn/bn_shift.c:214:1: Parameter `r->top` 212. * |n < BN_BITS2| or |n / BN_BITS2| being non-secret. 213. */ 214. > int bn_rshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n) 215. { 216. int i, top, nw; crypto/bn/bn_shift.c:229:9: Call 227. if (nw >= a->top) { 228. /* shouldn't happen, but formally required */ 229. BN_zero(r); ^ 230. return 1; 231. } crypto/bn/bn_lib.c:359:1: Parameter `a->top` 357. } 358. 359. > int BN_set_word(BIGNUM *a, BN_ULONG w) 360. { 361. bn_check_top(a); crypto/bn/bn_lib.c:362:9: Call 360. { 361. bn_check_top(a); 362. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 363. return 0; 364. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `a->top` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:668:12: Call 666. return a; 667. 668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 669. } 670. crypto/bn/bn_lib.c:245:1: Parameter `b->top` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `words` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:224:13: Call 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:228:1: Parameter `num` 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:17: Call 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/mem.c:230:5: Assignment 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:235:5: Assignment 233. if (ret != NULL) 234. memset(ret, 0, num); 235. return ret; ^ 236. } 237. crypto/bn/bn_lib.c:224:9: Assignment 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_mul` 230. assert(b->top <= words); 231. if (b->top > 0) 232. memcpy(a, b->d, sizeof(*a) * b->top); ^ 233. 234. return a;
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_45891
static int var_diamond_search(MpegEncContext * s, int *best, int dmin, int src_index, int ref_index, int const penalty_factor, int size, int h, int flags) { MotionEstContext * const c= &s->me; me_cmp_func cmpf, chroma_cmpf; int dia_size; LOAD_COMMON LOAD_COMMON2 int map_generation= c->map_generation; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; for(dia_size=1; dia_size<=c->dia_size; dia_size++){ int dir, start, end; const int x= best[0]; const int y= best[1]; start= FFMAX(0, y + dia_size - ymax); end = FFMIN(dia_size, xmax - x + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dir , y + dia_size - dir); } start= FFMAX(0, x + dia_size - xmax); end = FFMIN(dia_size, y - ymin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dia_size - dir, y - dir ); } start= FFMAX(0, -y + dia_size + ymin ); end = FFMIN(dia_size, x - xmin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dir , y - dia_size + dir); } start= FFMAX(0, -x + dia_size + xmin ); end = FFMIN(dia_size, ymax - y + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dia_size + dir, y + dir ); } if(x!=best[0] || y!=best[1]) dia_size=0; #if 0 { int dx, dy, i; static int stats[8*8]; dx= FFABS(x-best[0]); dy= FFABS(y-best[1]); stats[dy*8 + dx] ++; if(256*256*256*64 % (stats[0]+1)==0){ for(i=0; i<64; i++){ if((i&7)==0) printf("\n"); printf("%6d ", stats[i]); } printf("\n"); } } #endif } return dmin; } libavcodec/motion_est_template.c:916: error: Uninitialized Value The value read from xmax was never initialized. libavcodec/motion_est_template.c:916:16: 914. 915. start= FFMAX(0, y + dia_size - ymax); 916. end = FFMIN(dia_size, xmax - x + 1); ^ 917. for(dir= start; dir<end; dir++){ 918. int d;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L916
d2a_code_trace_data_45892
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, long max) { const unsigned char *p = *pp; unsigned long ret = 0; int i; if (max-- < 1) return 0; if (*p == 0x80) { *inf = 1; p++; } else { *inf = 0; i = *p & 0x7f; if (*p++ & 0x80) { if (max < i + 1) return 0; while (i > 0 && *p == 0) { p++; i--; } if (i > (int)sizeof(long)) return 0; while (i > 0) { ret <<= 8; ret |= *p++; i--; } if (ret > LONG_MAX) return 0; } else ret = i; } *pp = p; *rl = (long)ret; return 1; } test/ct_test.c:497: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] Size: [1, 12] by call to `CTLOG_new_from_base64`. Showing all 31 steps of the trace test/ct_test.c:492:5: Array declaration 490. { 491. CTLOG *ctlogp = NULL; 492. const char notb64[] = "\01\02\03\04"; ^ 493. const char pad[] = "===="; 494. const char name[] = "name"; test/ct_test.c:497:10: Call 495. 496. /* We expect these to both fail! */ 497. if (!TEST_true(!CTLOG_new_from_base64(&ctlogp, notb64, name)) ^ 498. || !TEST_true(!CTLOG_new_from_base64(&ctlogp, pad, name))) 499. return 0; crypto/ct/ct_b64.c:135:1: Parameter `pkey_base64->strlen` 133. * -1 on internal (malloc) failure 134. */ 135. > int CTLOG_new_from_base64(CTLOG **ct_log, const char *pkey_base64, const char *name) 136. { 137. unsigned char *pkey_der = NULL; crypto/ct/ct_b64.c:147:20: Call 145. } 146. 147. pkey_der_len = ct_base64_decode(pkey_base64, &pkey_der); ^ 148. if (pkey_der_len < 0) { 149. CTerr(CT_F_CTLOG_NEW_FROM_BASE64, CT_R_LOG_CONF_INVALID_KEY); crypto/ct/ct_b64.c:24:1: Parameter `**out` 22. * the caller. Do not provide a pre-allocated string in |out|. 23. */ 24. > static int ct_base64_decode(const char *in, unsigned char **out) 25. { 26. size_t inlen = strlen(in); crypto/ct/ct_b64.c:153:5: Assignment 151. } 152. 153. p = pkey_der; ^ 154. pkey = d2i_PUBKEY(NULL, &p, pkey_der_len); 155. OPENSSL_free(pkey_der); crypto/ct/ct_b64.c:154:12: Call 152. 153. p = pkey_der; 154. pkey = d2i_PUBKEY(NULL, &p, pkey_der_len); ^ 155. OPENSSL_free(pkey_der); 156. if (pkey == NULL) { crypto/x509/x_pubkey.c:181:1: Parameter `**pp` 179. */ 180. 181. > EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length) 182. { 183. X509_PUBKEY *xpk; crypto/x509/x_pubkey.c:186:5: Assignment 184. EVP_PKEY *pktmp; 185. const unsigned char *q; 186. q = *pp; ^ 187. xpk = d2i_X509_PUBKEY(NULL, &q, length); 188. if (!xpk) crypto/x509/x_pubkey.c:187:11: Call 185. const unsigned char *q; 186. q = *pp; 187. xpk = d2i_X509_PUBKEY(NULL, &q, length); ^ 188. if (!xpk) 189. return NULL; crypto/x509/x_pubkey.c:57:1: Parameter `**in` 55. } ASN1_SEQUENCE_END_cb(X509_PUBKEY, X509_PUBKEY) 56. 57. > IMPLEMENT_ASN1_FUNCTIONS(X509_PUBKEY) 58. 59. int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) crypto/x509/x_pubkey.c:57:1: Call 55. } ASN1_SEQUENCE_END_cb(X509_PUBKEY, X509_PUBKEY) 56. 57. > IMPLEMENT_ASN1_FUNCTIONS(X509_PUBKEY) 58. 59. int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) crypto/asn1/tasn_dec.c:95:1: Parameter `**in` 93. */ 94. 95. > ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, 96. const unsigned char **in, long len, 97. const ASN1_ITEM *it) crypto/asn1/tasn_dec.c:104:9: Call 102. pval = &ptmpval; 103. asn1_tlc_clear_nc(&c); 104. if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) ^ 105. return *pval; 106. return NULL; crypto/asn1/tasn_dec.c:109:1: Parameter `**in` 107. } 108. 109. > int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, 110. const ASN1_ITEM *it, 111. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:114:10: Call 112. { 113. int rv; 114. rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx); ^ 115. if (rv <= 0) 116. ASN1_item_ex_free(pval, it); crypto/asn1/tasn_dec.c:125:1: Parameter `**in` 123. */ 124. 125. > static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, 126. long len, const ASN1_ITEM *it, 127. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:169:9: Assignment 167. 168. case ASN1_ITYPE_MSTRING: 169. p = *in; ^ 170. /* Just read in tag and class */ 171. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, crypto/asn1/tasn_dec.c:171:15: Call 169. p = *in; 170. /* Just read in tag and class */ 171. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, ^ 172. &p, len, -1, 0, 1, ctx); 173. if (!ret) { crypto/asn1/tasn_dec.c:1060:1: Parameter `**in` 1058. */ 1059. 1060. > static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, 1061. char *inf, char *cst, 1062. const unsigned char **in, long len, crypto/asn1/tasn_dec.c:1069:5: Assignment 1067. long plen; 1068. const unsigned char *p, *q; 1069. p = *in; ^ 1070. q = p; 1071. crypto/asn1/tasn_dec.c:1079:13: Call 1077. p += ctx->hdrlen; 1078. } else { 1079. i = ASN1_get_object(&p, &plen, &ptag, &pclass, len); ^ 1080. if (ctx) { 1081. ctx->ret = i; crypto/asn1/asn1_lib.c:44:1: Parameter `**pp` 42. } 43. 44. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 45. int *pclass, long omax) 46. { crypto/asn1/asn1_lib.c:49:5: Assignment 47. int i, ret; 48. long l; 49. const unsigned char *p = *pp; ^ 50. int tag, xclass, inf; 51. long max = omax; crypto/asn1/asn1_lib.c:78:9: Assignment 76. } else { 77. tag = i; 78. p++; ^ 79. if (--max == 0) 80. goto err; crypto/asn1/asn1_lib.c:84:10: Call 82. *ptag = tag; 83. *pclass = xclass; 84. if (!asn1_get_length(&p, &inf, plength, max)) ^ 85. goto err; 86. crypto/asn1/asn1_lib.c:112:1: <Length trace> 110. * are stored most significant digit first. 111. */ 112. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 113. long max) 114. { crypto/asn1/asn1_lib.c:112:1: Parameter `**pp` 110. * are stored most significant digit first. 111. */ 112. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 113. long max) 114. { crypto/asn1/asn1_lib.c:115:5: Assignment 113. long max) 114. { 115. const unsigned char *p = *pp; ^ 116. unsigned long ret = 0; 117. int i; crypto/asn1/asn1_lib.c:127:14: Assignment 125. *inf = 0; 126. i = *p & 0x7f; 127. if (*p++ & 0x80) { ^ 128. if (max < i + 1) 129. return 0; crypto/asn1/asn1_lib.c:131:29: Array access: Offset: [2, +oo] Size: [1, 12] by call to `CTLOG_new_from_base64` 129. return 0; 130. /* Skip leading zeroes */ 131. while (i > 0 && *p == 0) { ^ 132. p++; 133. i--;
https://github.com/openssl/openssl/blob/c784a838e0947fcca761ee62def7d077dc06d37f/crypto/asn1/asn1_lib.c/#L131
d2a_code_trace_data_45893
int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, const char *label, size_t llen, const unsigned char *context, size_t contextlen, int use_context) { unsigned char *val = NULL; size_t vallen = 0, currentvalpos; int rv; vallen = llen + SSL3_RANDOM_SIZE * 2; if (use_context) { vallen += 2 + contextlen; } val = OPENSSL_malloc(vallen); if (val == NULL) goto err2; currentvalpos = 0; memcpy(val + currentvalpos, (unsigned char *)label, llen); currentvalpos += llen; memcpy(val + currentvalpos, s->s3.client_random, SSL3_RANDOM_SIZE); currentvalpos += SSL3_RANDOM_SIZE; memcpy(val + currentvalpos, s->s3.server_random, SSL3_RANDOM_SIZE); currentvalpos += SSL3_RANDOM_SIZE; if (use_context) { val[currentvalpos] = (contextlen >> 8) & 0xff; currentvalpos++; val[currentvalpos] = contextlen & 0xff; currentvalpos++; if ((contextlen > 0) || (context != NULL)) { memcpy(val + currentvalpos, context, contextlen); } } if (memcmp(val, TLS_MD_CLIENT_FINISH_CONST, TLS_MD_CLIENT_FINISH_CONST_SIZE) == 0) goto err1; if (memcmp(val, TLS_MD_SERVER_FINISH_CONST, TLS_MD_SERVER_FINISH_CONST_SIZE) == 0) goto err1; if (memcmp(val, TLS_MD_MASTER_SECRET_CONST, TLS_MD_MASTER_SECRET_CONST_SIZE) == 0) goto err1; if (memcmp(val, TLS_MD_EXTENDED_MASTER_SECRET_CONST, TLS_MD_EXTENDED_MASTER_SECRET_CONST_SIZE) == 0) goto err1; if (memcmp(val, TLS_MD_KEY_EXPANSION_CONST, TLS_MD_KEY_EXPANSION_CONST_SIZE) == 0) goto err1; rv = tls1_PRF(s, val, vallen, NULL, 0, NULL, 0, NULL, 0, NULL, 0, s->session->master_key, s->session->master_key_length, out, olen, 0); goto ret; err1: SSLerr(SSL_F_TLS1_EXPORT_KEYING_MATERIAL, SSL_R_TLS_ILLEGAL_EXPORTER_LABEL); rv = 0; goto ret; err2: SSLerr(SSL_F_TLS1_EXPORT_KEYING_MATERIAL, ERR_R_MALLOC_FAILURE); rv = 0; ret: OPENSSL_clear_free(val, vallen); return rv; } ssl/t1_enc.c:669: error: BUFFER_OVERRUN_S2 Offset: `llen` + 65 Size: [`llen` + 64, `llen` + `contextlen` + 66]. Showing all 13 steps of the trace ssl/t1_enc.c:636:1: <Offset trace> 634. } 635. 636. > int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, 637. const char *label, size_t llen, 638. const unsigned char *context, ssl/t1_enc.c:636:1: Parameter `llen` 634. } 635. 636. > int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, 637. const char *label, size_t llen, 638. const unsigned char *context, ssl/t1_enc.c:660:5: Assignment 658. currentvalpos = 0; 659. memcpy(val + currentvalpos, (unsigned char *)label, llen); 660. currentvalpos += llen; ^ 661. memcpy(val + currentvalpos, s->s3.client_random, SSL3_RANDOM_SIZE); 662. currentvalpos += SSL3_RANDOM_SIZE; ssl/t1_enc.c:662:5: Assignment 660. currentvalpos += llen; 661. memcpy(val + currentvalpos, s->s3.client_random, SSL3_RANDOM_SIZE); 662. currentvalpos += SSL3_RANDOM_SIZE; ^ 663. memcpy(val + currentvalpos, s->s3.server_random, SSL3_RANDOM_SIZE); 664. currentvalpos += SSL3_RANDOM_SIZE; ssl/t1_enc.c:664:5: Assignment 662. currentvalpos += SSL3_RANDOM_SIZE; 663. memcpy(val + currentvalpos, s->s3.server_random, SSL3_RANDOM_SIZE); 664. currentvalpos += SSL3_RANDOM_SIZE; ^ 665. 666. if (use_context) { ssl/t1_enc.c:668:9: Assignment 666. if (use_context) { 667. val[currentvalpos] = (contextlen >> 8) & 0xff; 668. currentvalpos++; ^ 669. val[currentvalpos] = contextlen & 0xff; 670. currentvalpos++; ssl/t1_enc.c:636:1: <Length trace> 634. } 635. 636. > int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, 637. const char *label, size_t llen, 638. const unsigned char *context, ssl/t1_enc.c:636:1: Parameter `llen` 634. } 635. 636. > int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, 637. const char *label, size_t llen, 638. const unsigned char *context, ssl/t1_enc.c:650:5: Assignment 648. * concatenation of values does not create a prohibited label. 649. */ 650. vallen = llen + SSL3_RANDOM_SIZE * 2; ^ 651. if (use_context) { 652. vallen += 2 + contextlen; ssl/t1_enc.c:655:11: Call 653. } 654. 655. val = OPENSSL_malloc(vallen); ^ 656. if (val == NULL) 657. goto err2; crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); ssl/t1_enc.c:655:5: Assignment 653. } 654. 655. val = OPENSSL_malloc(vallen); ^ 656. if (val == NULL) 657. goto err2; ssl/t1_enc.c:669:9: Array access: Offset: llen + 65 Size: [llen + 64, llen + contextlen + 66] 667. val[currentvalpos] = (contextlen >> 8) & 0xff; 668. currentvalpos++; 669. val[currentvalpos] = contextlen & 0xff; ^ 670. currentvalpos++; 671. if ((contextlen > 0) || (context != NULL)) {
https://github.com/openssl/openssl/blob/555cbb328ee2eaa9356cd23e2194c1600653c500/ssl/t1_enc.c/#L669
d2a_code_trace_data_45894
static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ MotionEstContext * const c= &s->me; const int stride= c->stride; const int uvstride= c->uvstride; const int qpel= flags&FLAG_QPEL; const int chroma= flags&FLAG_CHROMA; const int dxy= subx + (suby<<(1+qpel)); const int hx= subx + (x<<(1+qpel)); const int hy= suby + (y<<(1+qpel)); uint8_t * const * const ref= c->ref[ref_index]; uint8_t * const * const src= c->src[src_index]; int d; if(flags&FLAG_DIRECT){ assert(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)); if(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)){ const int time_pp= s->pp_time; const int time_pb= s->pb_time; const int mask= 2*qpel+1; if(s->mv_type==MV_TYPE_8X8){ int i; for(i=0; i<4; i++){ int fx = c->direct_basis_mv[i][0] + hx; int fy = c->direct_basis_mv[i][1] + hy; int bx = hx ? fx - c->co_located_mv[i][0] : c->co_located_mv[i][0]*(time_pb - time_pp)/time_pp + ((i &1)<<(qpel+4)); int by = hy ? fy - c->co_located_mv[i][1] : c->co_located_mv[i][1]*(time_pb - time_pp)/time_pp + ((i>>1)<<(qpel+4)); int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); uint8_t *dst= c->temp + 8*(i&1) + 8*stride*(i>>1); if(qpel){ c->qpel_put[1][fxy](dst, ref[0] + (fx>>2) + (fy>>2)*stride, stride); c->qpel_avg[1][bxy](dst, ref[8] + (bx>>2) + (by>>2)*stride, stride); }else{ c->hpel_put[1][fxy](dst, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 8); c->hpel_avg[1][bxy](dst, ref[8] + (bx>>1) + (by>>1)*stride, stride, 8); } } }else{ int fx = c->direct_basis_mv[0][0] + hx; int fy = c->direct_basis_mv[0][1] + hy; int bx = hx ? fx - c->co_located_mv[0][0] : (c->co_located_mv[0][0]*(time_pb - time_pp)/time_pp); int by = hy ? fy - c->co_located_mv[0][1] : (c->co_located_mv[0][1]*(time_pb - time_pp)/time_pp); int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); if(qpel){ c->qpel_put[1][fxy](c->temp , ref[0] + (fx>>2) + (fy>>2)*stride , stride); c->qpel_put[1][fxy](c->temp + 8 , ref[0] + (fx>>2) + (fy>>2)*stride + 8 , stride); c->qpel_put[1][fxy](c->temp + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8*stride, stride); c->qpel_put[1][fxy](c->temp + 8 + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8 + 8*stride, stride); c->qpel_avg[1][bxy](c->temp , ref[8] + (bx>>2) + (by>>2)*stride , stride); c->qpel_avg[1][bxy](c->temp + 8 , ref[8] + (bx>>2) + (by>>2)*stride + 8 , stride); c->qpel_avg[1][bxy](c->temp + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8*stride, stride); c->qpel_avg[1][bxy](c->temp + 8 + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8 + 8*stride, stride); }else{ assert((fx>>1) + 16*s->mb_x >= -16); assert((fy>>1) + 16*s->mb_y >= -16); assert((fx>>1) + 16*s->mb_x <= s->width); assert((fy>>1) + 16*s->mb_y <= s->height); assert((bx>>1) + 16*s->mb_x >= -16); assert((by>>1) + 16*s->mb_y >= -16); assert((bx>>1) + 16*s->mb_x <= s->width); assert((by>>1) + 16*s->mb_y <= s->height); c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16); c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16); } } d = cmp_func(s, c->temp, src[0], stride, 16); }else d= 256*256*256*32; }else{ int uvdxy; if(dxy){ if(qpel){ c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride); if(chroma){ int cx= hx/2; int cy= hy/2; cx= (cx>>1)|(cx&1); cy= (cy>>1)|(cy&1); uvdxy= (cx&1) + 2*(cy&1); } }else{ c->hpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride, h); if(chroma) uvdxy= dxy | (x&1) | (2*(y&1)); } d = cmp_func(s, c->temp, src[0], stride, h); }else{ d = cmp_func(s, src[0], ref[0] + x + y*stride, stride, h); if(chroma) uvdxy= (x&1) + 2*(y&1); } if(chroma){ uint8_t * const uvtemp= c->temp + 16*stride; c->hpel_put[size+1][uvdxy](uvtemp , ref[1] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); c->hpel_put[size+1][uvdxy](uvtemp+8, ref[2] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); d += chroma_cmp_func(s, uvtemp , src[1], uvstride, h>>1); d += chroma_cmp_func(s, uvtemp+8, src[2], uvstride, h>>1); } } #if 0 if(full_pel){ const int index= (((y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1); score_map[index]= d; } d += (c->mv_penalty[hx - c->pred_x] + c->mv_penalty[hy - c->pred_y])*c->penalty_factor; #endif return d; } libavcodec/motion_est.c:1273: error: Buffer Overrun L1 Offset: 8 Size: 4 by call to `ff_epzs_motion_search`. libavcodec/motion_est.c:1273:16: Call 1271. 1272. } 1273. dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, 0, s->p_mv_table, (1<<16)>>shift, 0, 16); ^ 1274. 1275. break; libavcodec/motion_est_template.c:1116:1: Parameter `ref_index` 1114. 1115. //this function is dedicated to the braindamaged gcc 1116. inline int ff_epzs_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr, ^ 1117. int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], 1118. int ref_mv_scale, int size, int h) libavcodec/motion_est_template.c:1123:16: Call 1121. //FIXME convert other functions in the same way if faster 1122. if(c->flags==0 && h==16 && size==0){ 1123. return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, 0, 0, 16); ^ 1124. // case FLAG_QPEL: 1125. // return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, FLAG_QPEL); libavcodec/motion_est_template.c:999:1: Parameter `ref_index` 997. optimal mv. 998. */ 999. static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr, ^ 1000. int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], 1001. int ref_mv_scale, int flags, int size, int h) libavcodec/motion_est_template.c:1043:9: Call 1041. /* first line */ 1042. if (s->first_slice_line) { 1043. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) ^ 1044. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, 1045. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) libavcodec/motion_est.c:108:1: <Length trace> 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:108:1: Parameter `ref_index` 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:119:5: Assignment 117. const int hx= subx + (x<<(1+qpel)); 118. const int hy= suby + (y<<(1+qpel)); 119. uint8_t * const * const ref= c->ref[ref_index]; ^ 120. uint8_t * const * const src= c->src[src_index]; 121. int d; libavcodec/motion_est.c:176:50: Array access: Offset: 8 Size: 4 by call to `ff_epzs_motion_search` 174. 175. c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16); 176. c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16); ^ 177. } 178. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est.c/#L176
d2a_code_trace_data_45895
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_gcd.c:609: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_nnmod`. Showing all 32 steps of the trace crypto/bn/bn_gcd.c:458:1: Parameter `ctx->stack.depth` 456. * not contain branches that may leak sensitive information. 457. */ 458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 459. const BIGNUM *a, const BIGNUM *n, 460. BN_CTX *ctx) crypto/bn/bn_gcd.c:469:5: Call 467. bn_check_top(n); 468. 469. BN_CTX_start(ctx); ^ 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gcd.c:470:9: Call 468. 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); ^ 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:471:9: Call 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); ^ 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:472:9: Call 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); ^ 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:473:9: Call 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); ^ 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:474:9: Call 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); ^ 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:475:9: Call 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); ^ 476. T = BN_CTX_get(ctx); 477. if (T == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:476:9: Call 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); ^ 477. if (T == NULL) 478. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:609:18: Call 607. goto err; 608. } else { 609. if (!BN_nnmod(R, Y, n, ctx)) ^ 610. goto err; 611. } crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_nnmod` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_45896
static int scan_for_extensions(AVCodecContext *avctx) { DCAContext *s = avctx->priv_data; int core_ss_end, ret; core_ss_end = FFMIN(s->frame_size, s->dca_buffer_size) * 8; if (s->core_ext_mask < 0 || s->core_ext_mask & DCA_EXT_XCH) { s->core_ext_mask = FFMAX(s->core_ext_mask, 0); skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); while (core_ss_end - get_bits_count(&s->gb) >= 32) { uint32_t bits = get_bits_long(&s->gb, 32); int i; switch (bits) { case DCA_SYNCWORD_XCH: { int ext_amode, xch_fsize; s->xch_base_channel = s->prim_channels; xch_fsize = show_bits(&s->gb, 10); if ((s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize) && (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize + 1)) continue; skip_bits(&s->gb, 10); s->core_ext_mask |= DCA_EXT_XCH; if ((ext_amode = get_bits(&s->gb, 4)) != 1) { av_log(avctx, AV_LOG_ERROR, "XCh extension amode %d not supported!\n", ext_amode); continue; } dca_parse_audio_coding_header(s, s->xch_base_channel); for (i = 0; i < (s->sample_blocks / 8); i++) if ((ret = dca_decode_block(s, s->xch_base_channel, i))) { av_log(avctx, AV_LOG_ERROR, "error decoding XCh extension\n"); continue; } s->xch_present = 1; break; } case DCA_SYNCWORD_XXCH: s->core_ext_mask |= DCA_EXT_XXCH; break; case 0x1d95f262: { int fsize96 = show_bits(&s->gb, 12) + 1; if (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + fsize96) continue; av_log(avctx, AV_LOG_DEBUG, "X96 extension found at %d bits\n", get_bits_count(&s->gb)); skip_bits(&s->gb, 12); av_log(avctx, AV_LOG_DEBUG, "FSIZE96 = %d bytes\n", fsize96); av_log(avctx, AV_LOG_DEBUG, "REVNO = %d\n", get_bits(&s->gb, 4)); s->core_ext_mask |= DCA_EXT_X96; break; } } skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); } } else { skip_bits_long(&s->gb, core_ss_end - get_bits_count(&s->gb)); } if (s->core_ext_mask & DCA_EXT_X96) s->profile = FF_PROFILE_DTS_96_24; else if (s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH)) s->profile = FF_PROFILE_DTS_ES; if (s->dca_buffer_size - s->frame_size > 32 && get_bits_long(&s->gb, 32) == DCA_SYNCWORD_SUBSTREAM) ff_dca_exss_parse_header(s); return ret; } libavcodec/dcadec.c:1246: error: Uninitialized Value The value read from ret was never initialized. libavcodec/dcadec.c:1246:5: 1244. ff_dca_exss_parse_header(s); 1245. 1246. return ret; ^ 1247. } 1248.
https://github.com/libav/libav/blob/bb198c4997d5036f3bf91de51e44f807115677d0/libavcodec/dcadec.c/#L1246
d2a_code_trace_data_45897
static int vorbis_parse_audio_packet(vorbis_context *vc) { GetBitContext *gb=&vc->gb; uint_fast8_t previous_window=0,next_window=0; uint_fast8_t mode_number; uint_fast16_t blocksize; int_fast32_t i,j; uint_fast8_t no_residue[vc->audio_channels]; uint_fast8_t do_not_decode[vc->audio_channels]; vorbis_mapping *mapping; float *ch_res_ptr=vc->channel_residues; float *ch_floor_ptr=vc->channel_floors; uint_fast8_t res_chan[vc->audio_channels]; uint_fast8_t res_num=0; int_fast16_t retlen=0; uint_fast16_t saved_start=0; float fadd_bias = vc->add_bias; if (get_bits1(gb)) { av_log(vc->avccontext, AV_LOG_ERROR, "Not a Vorbis I audio packet.\n"); return -1; } if (vc->mode_count==1) { mode_number=0; } else { mode_number=get_bits(gb, ilog(vc->mode_count-1)); } vc->mode_number=mode_number; mapping=&vc->mappings[vc->modes[mode_number].mapping]; AV_DEBUG(" Mode number: %d , mapping: %d , blocktype %d \n", mode_number, vc->modes[mode_number].mapping, vc->modes[mode_number].blockflag); if (vc->modes[mode_number].blockflag) { previous_window=get_bits1(gb); next_window=get_bits1(gb); } blocksize=vc->blocksize[vc->modes[mode_number].blockflag]; memset(ch_res_ptr, 0, sizeof(float)*vc->audio_channels*blocksize/2); memset(ch_floor_ptr, 0, sizeof(float)*vc->audio_channels*blocksize/2); for(i=0;i<vc->audio_channels;++i) { vorbis_floor *floor; if (mapping->submaps>1) { floor=&vc->floors[mapping->submap_floor[mapping->mux[i]]]; } else { floor=&vc->floors[mapping->submap_floor[0]]; } no_residue[i]=floor->decode(vc, &floor->data, ch_floor_ptr); ch_floor_ptr+=blocksize/2; } for(i=mapping->coupling_steps-1;i>=0;--i) { if (!(no_residue[mapping->magnitude[i]] & no_residue[mapping->angle[i]])) { no_residue[mapping->magnitude[i]]=0; no_residue[mapping->angle[i]]=0; } } for(i=0;i<mapping->submaps;++i) { vorbis_residue *residue; uint_fast8_t ch=0; for(j=0;j<vc->audio_channels;++j) { if ((mapping->submaps==1) || (i=mapping->mux[j])) { res_chan[j]=res_num; if (no_residue[j]) { do_not_decode[ch]=1; } else { do_not_decode[ch]=0; } ++ch; ++res_num; } } residue=&vc->residues[mapping->submap_residue[i]]; vorbis_residue_decode(vc, residue, ch, do_not_decode, ch_res_ptr, blocksize/2); ch_res_ptr+=ch*blocksize/2; } for(i=mapping->coupling_steps-1;i>=0;--i) { float *mag, *ang; mag=vc->channel_residues+res_chan[mapping->magnitude[i]]*blocksize/2; ang=vc->channel_residues+res_chan[mapping->angle[i]]*blocksize/2; vc->dsp.vorbis_inverse_coupling(mag, ang, blocksize/2); } for(j=0, ch_floor_ptr=vc->channel_floors;j<vc->audio_channels;++j,ch_floor_ptr+=blocksize/2) { ch_res_ptr=vc->channel_residues+res_chan[j]*blocksize/2; vc->dsp.vector_fmul(ch_floor_ptr, ch_res_ptr, blocksize/2); } for(j=0;j<vc->audio_channels;++j) { uint_fast8_t step=vc->audio_channels; uint_fast16_t k; float *saved=vc->saved+j*vc->blocksize[1]/2; float *ret=vc->ret; const float *lwin=vc->win[1]; const float *swin=vc->win[0]; float *buf=vc->buf; float *buf_tmp=vc->buf_tmp; ch_floor_ptr=vc->channel_floors+j*blocksize/2; saved_start=vc->saved_start; vc->mdct[0].fft.imdct_calc(&vc->mdct[vc->modes[mode_number].blockflag], buf, ch_floor_ptr, buf_tmp); if (vc->modes[mode_number].blockflag) { if (previous_window) { vc->dsp.vector_fmul_add_add(ret+j, buf, lwin, saved, vc->add_bias, vc->blocksize[1]/2, step); retlen=vc->blocksize[1]/2; } else { int len = (vc->blocksize[1]-vc->blocksize[0])/4; buf += len; vc->dsp.vector_fmul_add_add(ret+j, buf, swin, saved, vc->add_bias, vc->blocksize[0]/2, step); k = vc->blocksize[0]/2*step + j; buf += vc->blocksize[0]/2; if(vc->exp_bias){ for(i=0; i<len; i++, k+=step) ((uint32_t*)ret)[k] = ((uint32_t*)buf)[i] + vc->exp_bias; } else { for(i=0; i<len; i++, k+=step) ret[k] = buf[i] + fadd_bias; } buf=vc->buf; retlen=vc->blocksize[0]/2+len; } if (next_window) { buf += vc->blocksize[1]/2; vc->dsp.vector_fmul_reverse(saved, buf, lwin, vc->blocksize[1]/2); saved_start=0; } else { saved_start=(vc->blocksize[1]-vc->blocksize[0])/4; buf += vc->blocksize[1]/2; for(i=0; i<saved_start; i++) ((uint32_t*)saved)[i] = ((uint32_t*)buf)[i] + vc->exp_bias; vc->dsp.vector_fmul_reverse(saved+saved_start, buf+saved_start, swin, vc->blocksize[0]/2); } } else { if(vc->add_bias) { for(k=j, i=0;i<saved_start;++i, k+=step) ret[k] = saved[i] + fadd_bias; } else { for(k=j, i=0;i<saved_start;++i, k+=step) ret[k] = saved[i]; } vc->dsp.vector_fmul_add_add(ret+k, buf, swin, saved+saved_start, vc->add_bias, vc->blocksize[0]/2, step); retlen=saved_start+vc->blocksize[0]/2; buf += vc->blocksize[0]/2; vc->dsp.vector_fmul_reverse(saved, buf, swin, vc->blocksize[0]/2); saved_start=0; } } vc->saved_start=saved_start; return retlen*vc->audio_channels; } libavcodec/vorbis_dec.c:1472: error: Uninitialized Value The value read from no_residue[_] was never initialized. libavcodec/vorbis_dec.c:1472:21: 1470. if ((mapping->submaps==1) || (i=mapping->mux[j])) { 1471. res_chan[j]=res_num; 1472. if (no_residue[j]) { ^ 1473. do_not_decode[ch]=1; 1474. } else {
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vorbis_dec.c/#L1472
d2a_code_trace_data_45898
static int tree_evaluate(X509_POLICY_TREE *tree) { int ret, i; X509_POLICY_LEVEL *curr = tree->levels + 1; const X509_POLICY_CACHE *cache; for (i = 1; i < tree->nlevel; i++, curr++) { cache = policy_cache_set(curr->cert); if (!tree_link_nodes(curr, cache)) return X509_PCY_TREE_INTERNAL; if (!(curr->flags & X509_V_FLAG_INHIBIT_ANY) && !tree_link_any(curr, cache, tree)) return X509_PCY_TREE_INTERNAL; #ifdef OPENSSL_POLICY_DEBUG tree_print("before tree_prune()", tree, curr); #endif ret = tree_prune(tree, curr); if (ret != X509_PCY_TREE_VALID) return ret; } return X509_PCY_TREE_VALID; } crypto/x509v3/pcy_tree.c:631: error: NULL_DEREFERENCE pointer `cache` last assigned on line 630 could be null and is dereferenced by call to `tree_link_nodes()` at line 631, column 14. Showing all 46 steps of the trace crypto/x509v3/pcy_tree.c:623:1: start of procedure tree_evaluate() 621. * (see tree_prune()). 622. */ 623. > static int tree_evaluate(X509_POLICY_TREE *tree) 624. { 625. int ret, i; crypto/x509v3/pcy_tree.c:626:5: 624. { 625. int ret, i; 626. > X509_POLICY_LEVEL *curr = tree->levels + 1; 627. const X509_POLICY_CACHE *cache; 628. crypto/x509v3/pcy_tree.c:629:10: 627. const X509_POLICY_CACHE *cache; 628. 629. > for (i = 1; i < tree->nlevel; i++, curr++) { 630. cache = policy_cache_set(curr->cert); 631. if (!tree_link_nodes(curr, cache)) crypto/x509v3/pcy_tree.c:629:17: Loop condition is true. Entering loop body 627. const X509_POLICY_CACHE *cache; 628. 629. for (i = 1; i < tree->nlevel; i++, curr++) { ^ 630. cache = policy_cache_set(curr->cert); 631. if (!tree_link_nodes(curr, cache)) crypto/x509v3/pcy_tree.c:630:9: 628. 629. for (i = 1; i < tree->nlevel; i++, curr++) { 630. > cache = policy_cache_set(curr->cert); 631. if (!tree_link_nodes(curr, cache)) 632. return X509_PCY_TREE_INTERNAL; crypto/x509v3/pcy_cache.c:223:1: start of procedure policy_cache_set() 221. } 222. 223. > const X509_POLICY_CACHE *policy_cache_set(X509 *x) 224. { 225. crypto/x509v3/pcy_cache.c:226:9: Taking true branch 224. { 225. 226. if (x->policy_cache == NULL) { ^ 227. CRYPTO_w_lock(CRYPTO_LOCK_X509); 228. policy_cache_new(x); crypto/x509v3/pcy_cache.c:227:9: 225. 226. if (x->policy_cache == NULL) { 227. > CRYPTO_w_lock(CRYPTO_LOCK_X509); 228. policy_cache_new(x); 229. CRYPTO_w_unlock(CRYPTO_LOCK_X509); crypto/lock.c:413:1: start of procedure CRYPTO_lock() 411. } 412. 413. > void CRYPTO_lock(int mode, int type, const char *file, int line) 414. { 415. #ifdef LOCK_DEBUG crypto/lock.c:440:9: Taking false branch 438. } 439. #endif 440. if (type < 0) { ^ 441. if (dynlock_lock_callback != NULL) { 442. struct CRYPTO_dynlock_value *pointer crypto/lock.c:451:16: Taking true branch 449. CRYPTO_destroy_dynlockid(type); 450. } 451. } else if (locking_callback != NULL) ^ 452. locking_callback(mode, type, file, line); 453. } crypto/lock.c:452:9: Skipping __function_pointer__(): unresolved function pointer 450. } 451. } else if (locking_callback != NULL) 452. locking_callback(mode, type, file, line); ^ 453. } 454. crypto/lock.c:440:5: 438. } 439. #endif 440. > if (type < 0) { 441. if (dynlock_lock_callback != NULL) { 442. struct CRYPTO_dynlock_value *pointer crypto/lock.c:453:1: return from a call to CRYPTO_lock 451. } else if (locking_callback != NULL) 452. locking_callback(mode, type, file, line); 453. > } 454. 455. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, crypto/x509v3/pcy_cache.c:228:9: 226. if (x->policy_cache == NULL) { 227. CRYPTO_w_lock(CRYPTO_LOCK_X509); 228. > policy_cache_new(x); 229. CRYPTO_w_unlock(CRYPTO_LOCK_X509); 230. } crypto/x509v3/pcy_cache.c:122:1: start of procedure policy_cache_new() 120. } 121. 122. > static int policy_cache_new(X509 *x) 123. { 124. X509_POLICY_CACHE *cache; crypto/x509v3/pcy_cache.c:125:5: 123. { 124. X509_POLICY_CACHE *cache; 125. > ASN1_INTEGER *ext_any = NULL; 126. POLICY_CONSTRAINTS *ext_pcons = NULL; 127. CERTIFICATEPOLICIES *ext_cpols = NULL; crypto/x509v3/pcy_cache.c:126:5: 124. X509_POLICY_CACHE *cache; 125. ASN1_INTEGER *ext_any = NULL; 126. > POLICY_CONSTRAINTS *ext_pcons = NULL; 127. CERTIFICATEPOLICIES *ext_cpols = NULL; 128. POLICY_MAPPINGS *ext_pmaps = NULL; crypto/x509v3/pcy_cache.c:127:5: 125. ASN1_INTEGER *ext_any = NULL; 126. POLICY_CONSTRAINTS *ext_pcons = NULL; 127. > CERTIFICATEPOLICIES *ext_cpols = NULL; 128. POLICY_MAPPINGS *ext_pmaps = NULL; 129. int i; crypto/x509v3/pcy_cache.c:128:5: 126. POLICY_CONSTRAINTS *ext_pcons = NULL; 127. CERTIFICATEPOLICIES *ext_cpols = NULL; 128. > POLICY_MAPPINGS *ext_pmaps = NULL; 129. int i; 130. cache = OPENSSL_malloc(sizeof(*cache)); crypto/x509v3/pcy_cache.c:130:5: 128. POLICY_MAPPINGS *ext_pmaps = NULL; 129. int i; 130. > cache = OPENSSL_malloc(sizeof(*cache)); 131. if (cache == NULL) 132. return 0; crypto/mem.c:119:1: start of procedure CRYPTO_malloc() 117. } 118. 119. > void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. void *ret = NULL; crypto/mem.c:121:5: 119. void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. > void *ret = NULL; 122. 123. if (num <= 0) crypto/mem.c:123:9: Taking false branch 121. void *ret = NULL; 122. 123. if (num <= 0) ^ 124. return NULL; 125. crypto/mem.c:126:5: 124. return NULL; 125. 126. > allow_customize = 0; 127. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 128. if (call_malloc_debug) { crypto/mem.c:136:5: 134. } 135. #else 136. > (void)file; 137. (void)line; 138. ret = malloc(num); crypto/mem.c:137:5: 135. #else 136. (void)file; 137. > (void)line; 138. ret = malloc(num); 139. #endif crypto/mem.c:138:5: 136. (void)file; 137. (void)line; 138. > ret = malloc(num); 139. #endif 140. crypto/mem.c:153:5: 151. #endif 152. 153. > return ret; 154. } 155. crypto/mem.c:154:1: return from a call to CRYPTO_malloc 152. 153. return ret; 154. > } 155. 156. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/x509v3/pcy_cache.c:131:9: Taking true branch 129. int i; 130. cache = OPENSSL_malloc(sizeof(*cache)); 131. if (cache == NULL) ^ 132. return 0; 133. cache->anyPolicy = NULL; crypto/x509v3/pcy_cache.c:132:9: 130. cache = OPENSSL_malloc(sizeof(*cache)); 131. if (cache == NULL) 132. > return 0; 133. cache->anyPolicy = NULL; 134. cache->data = NULL; crypto/x509v3/pcy_cache.c:212:1: return from a call to policy_cache_new 210. return 1; 211. 212. > } 213. 214. void policy_cache_free(X509_POLICY_CACHE *cache) crypto/x509v3/pcy_cache.c:229:9: 227. CRYPTO_w_lock(CRYPTO_LOCK_X509); 228. policy_cache_new(x); 229. > CRYPTO_w_unlock(CRYPTO_LOCK_X509); 230. } 231. crypto/lock.c:413:1: start of procedure CRYPTO_lock() 411. } 412. 413. > void CRYPTO_lock(int mode, int type, const char *file, int line) 414. { 415. #ifdef LOCK_DEBUG crypto/lock.c:440:9: Taking false branch 438. } 439. #endif 440. if (type < 0) { ^ 441. if (dynlock_lock_callback != NULL) { 442. struct CRYPTO_dynlock_value *pointer crypto/lock.c:451:16: Taking true branch 449. CRYPTO_destroy_dynlockid(type); 450. } 451. } else if (locking_callback != NULL) ^ 452. locking_callback(mode, type, file, line); 453. } crypto/lock.c:452:9: Skipping __function_pointer__(): unresolved function pointer 450. } 451. } else if (locking_callback != NULL) 452. locking_callback(mode, type, file, line); ^ 453. } 454. crypto/lock.c:440:5: 438. } 439. #endif 440. > if (type < 0) { 441. if (dynlock_lock_callback != NULL) { 442. struct CRYPTO_dynlock_value *pointer crypto/lock.c:453:1: return from a call to CRYPTO_lock 451. } else if (locking_callback != NULL) 452. locking_callback(mode, type, file, line); 453. > } 454. 455. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, crypto/x509v3/pcy_cache.c:232:5: 230. } 231. 232. > return x->policy_cache; 233. 234. } crypto/x509v3/pcy_cache.c:234:1: return from a call to policy_cache_set 232. return x->policy_cache; 233. 234. > } 235. 236. X509_POLICY_DATA *policy_cache_find_data(const X509_POLICY_CACHE *cache, crypto/x509v3/pcy_tree.c:631:14: 629. for (i = 1; i < tree->nlevel; i++, curr++) { 630. cache = policy_cache_set(curr->cert); 631. > if (!tree_link_nodes(curr, cache)) 632. return X509_PCY_TREE_INTERNAL; 633. crypto/x509v3/pcy_tree.c:320:1: start of procedure tree_link_nodes() 318. * Return value: 1 on success, 0 otherwise. 319. */ 320. > static int tree_link_nodes(X509_POLICY_LEVEL *curr, 321. const X509_POLICY_CACHE *cache) 322. { crypto/x509v3/pcy_tree.c:325:10: 323. int i; 324. 325. > for (i = 0; i < sk_X509_POLICY_DATA_num(cache->data); i++) { 326. X509_POLICY_DATA *data = sk_X509_POLICY_DATA_value(cache->data, i); 327. crypto/x509v3/pcy_tree.c:325:17: 323. int i; 324. 325. > for (i = 0; i < sk_X509_POLICY_DATA_num(cache->data); i++) { 326. X509_POLICY_DATA *data = sk_X509_POLICY_DATA_value(cache->data, i); 327.
https://github.com/openssl/openssl/blob/895c2f84a6a083fc8b9f69f962ed19da12ce3b40/crypto/x509v3/pcy_tree.c/#L631
d2a_code_trace_data_45899
static void block_permute(int16_t *block, uint8_t *permutation, const uint8_t *scantable, int last) { int i; int16_t temp[64]; if (last <= 0) return; for (i = 0; i <= last; i++) { const int j = scantable[i]; temp[j] = block[j]; block[j] = 0; } for (i = 0; i <= last; i++) { const int j = scantable[i]; const int perm_j = permutation[j]; block[perm_j] = temp[j]; } } libavcodec/mpegvideo_enc.c:4233: error: Uninitialized Value The value read from temp[_] was never initialized. libavcodec/mpegvideo_enc.c:4233:9: 4231. const int j = scantable[i]; 4232. const int perm_j = permutation[j]; 4233. block[perm_j] = temp[j]; ^ 4234. } 4235. }
https://github.com/libav/libav/blob/a7ac1a7b94447f33ae95be4d6d186e2775977f91/libavcodec/mpegvideo_enc.c/#L4233
d2a_code_trace_data_45900
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, long max) { const unsigned char *p = *pp; unsigned long ret = 0; int i; if (max-- < 1) return 0; if (*p == 0x80) { *inf = 1; p++; } else { *inf = 0; i = *p & 0x7f; if (*p++ & 0x80) { if (max < i + 1) return 0; while (i > 0 && *p == 0) { p++; i--; } if (i > (int)sizeof(long)) return 0; while (i > 0) { ret <<= 8; ret |= *p++; i--; } if (ret > LONG_MAX) return 0; } else ret = i; } *pp = p; *rl = (long)ret; return 1; } crypto/asn1/a_d2i_fp.c:69: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] Size: [1, 2147483644] by call to `ASN1_item_d2i`. Showing all 26 steps of the trace crypto/asn1/a_d2i_fp.c:64:11: Call 62. int len; 63. 64. len = asn1_d2i_read_bio(in, &b); ^ 65. if (len < 0) 66. goto err; crypto/asn1/a_d2i_fp.c:119:38: Call 117. want -= (len - off); 118. 119. if (len + want < len || !BUF_MEM_grow_clean(b, len + want)) { ^ 120. ASN1err(ASN1_F_ASN1_D2I_READ_BIO, ERR_R_MALLOC_FAILURE); 121. goto err; crypto/buffer/buffer.c:111:1: Parameter `*str->data` 109. } 110. 111. > size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len) 112. { 113. char *ret; crypto/asn1/a_d2i_fp.c:68:5: Assignment 66. goto err; 67. 68. p = (const unsigned char *)b->data; ^ 69. ret = ASN1_item_d2i(x, &p, len, it); 70. err: crypto/asn1/a_d2i_fp.c:69:11: Call 67. 68. p = (const unsigned char *)b->data; 69. ret = ASN1_item_d2i(x, &p, len, it); ^ 70. err: 71. BUF_MEM_free(b); crypto/asn1/tasn_dec.c:95:1: Parameter `**in` 93. */ 94. 95. > ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, 96. const unsigned char **in, long len, 97. const ASN1_ITEM *it) crypto/asn1/tasn_dec.c:104:9: Call 102. pval = &ptmpval; 103. asn1_tlc_clear_nc(&c); 104. if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) ^ 105. return *pval; 106. return NULL; crypto/asn1/tasn_dec.c:109:1: Parameter `**in` 107. } 108. 109. > int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, 110. const ASN1_ITEM *it, 111. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:114:10: Call 112. { 113. int rv; 114. rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx); ^ 115. if (rv <= 0) 116. ASN1_item_ex_free(pval, it); crypto/asn1/tasn_dec.c:125:1: Parameter `**in` 123. */ 124. 125. > static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, 126. long len, const ASN1_ITEM *it, 127. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:162:20: Call 160. goto err; 161. } 162. return asn1_template_ex_d2i(pval, in, len, ^ 163. it->templates, opt, ctx); 164. } crypto/asn1/tasn_dec.c:420:1: Parameter `**in` 418. */ 419. 420. > static int asn1_template_ex_d2i(ASN1_VALUE **val, 421. const unsigned char **in, long inlen, 422. const ASN1_TEMPLATE *tt, char opt, crypto/asn1/tasn_dec.c:435:5: Assignment 433. aclass = flags & ASN1_TFLG_TAG_CLASS; 434. 435. p = *in; ^ 436. 437. /* Check if EXPLICIT tag expected */ crypto/asn1/tasn_dec.c:444:15: Call 442. * where it starts: so read in EXPLICIT header to get the info. 443. */ 444. ret = asn1_check_tlen(&len, NULL, NULL, &exp_eoc, &cst, ^ 445. &p, inlen, tt->tag, aclass, opt, ctx); 446. q = p; crypto/asn1/tasn_dec.c:1060:1: Parameter `**in` 1058. */ 1059. 1060. > static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, 1061. char *inf, char *cst, 1062. const unsigned char **in, long len, crypto/asn1/tasn_dec.c:1069:5: Assignment 1067. long plen; 1068. const unsigned char *p, *q; 1069. p = *in; ^ 1070. q = p; 1071. crypto/asn1/tasn_dec.c:1079:13: Call 1077. p += ctx->hdrlen; 1078. } else { 1079. i = ASN1_get_object(&p, &plen, &ptag, &pclass, len); ^ 1080. if (ctx) { 1081. ctx->ret = i; crypto/asn1/asn1_lib.c:44:1: Parameter `**pp` 42. } 43. 44. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 45. int *pclass, long omax) 46. { crypto/asn1/asn1_lib.c:49:5: Assignment 47. int i, ret; 48. long l; 49. const unsigned char *p = *pp; ^ 50. int tag, xclass, inf; 51. long max = omax; crypto/asn1/asn1_lib.c:78:9: Assignment 76. } else { 77. tag = i; 78. p++; ^ 79. if (--max == 0) 80. goto err; crypto/asn1/asn1_lib.c:84:10: Call 82. *ptag = tag; 83. *pclass = xclass; 84. if (!asn1_get_length(&p, &inf, plength, max)) ^ 85. goto err; 86. crypto/asn1/asn1_lib.c:112:1: <Length trace> 110. * are stored most significant digit first. 111. */ 112. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 113. long max) 114. { crypto/asn1/asn1_lib.c:112:1: Parameter `**pp` 110. * are stored most significant digit first. 111. */ 112. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 113. long max) 114. { crypto/asn1/asn1_lib.c:115:5: Assignment 113. long max) 114. { 115. const unsigned char *p = *pp; ^ 116. unsigned long ret = 0; 117. int i; crypto/asn1/asn1_lib.c:127:14: Assignment 125. *inf = 0; 126. i = *p & 0x7f; 127. if (*p++ & 0x80) { ^ 128. if (max < i + 1) 129. return 0; crypto/asn1/asn1_lib.c:131:29: Array access: Offset: [2, +oo] Size: [1, 2147483644] by call to `ASN1_item_d2i` 129. return 0; 130. /* Skip leading zeroes */ 131. while (i > 0 && *p == 0) { ^ 132. p++; 133. i--;
https://github.com/openssl/openssl/blob/c784a838e0947fcca761ee62def7d077dc06d37f/crypto/asn1/asn1_lib.c/#L131
d2a_code_trace_data_45901
void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, MPA_INT *window, int *dither_state, OUT_INT *samples, int incr, int32_t sb_samples[SBLIMIT]) { int32_t tmp[32]; register MPA_INT *synth_buf; register const MPA_INT *w, *w2, *p; int j, offset, v; OUT_INT *samples2; #if FRAC_BITS <= 15 int sum, sum2; #else int64_t sum, sum2; #endif dct32(tmp, sb_samples); offset = *synth_buf_offset; synth_buf = synth_buf_ptr + offset; for(j=0;j<32;j++) { v = tmp[j]; #if FRAC_BITS <= 15 v = av_clip_int16(v); #endif synth_buf[j] = v; } memcpy(synth_buf + 512, synth_buf, 32 * sizeof(MPA_INT)); samples2 = samples + 31 * incr; w = window; w2 = window + 31; sum = *dither_state; p = synth_buf + 16; SUM8(sum, +=, w, p); p = synth_buf + 48; SUM8(sum, -=, w + 32, p); *samples = round_sample(&sum); samples += incr; w++; for(j=1;j<16;j++) { sum2 = 0; p = synth_buf + 16 + j; SUM8P2(sum, +=, sum2, -=, w, w2, p); p = synth_buf + 48 - j; SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p); *samples = round_sample(&sum); samples += incr; sum += sum2; *samples2 = round_sample(&sum); samples2 -= incr; w++; w2--; } p = synth_buf + 32; SUM8(sum, -=, w + 32, p); *samples = round_sample(&sum); *dither_state= sum; offset = (offset - 32) & 511; *synth_buf_offset = offset; } libavcodec/mpc.c:60: error: Buffer Overrun L2 Offset: [160+min(0, `c->synth_buf_offset[*]`), 161+max(511, `c->synth_buf_offset[*]`)] (⇐ [32+min(0, `c->synth_buf_offset[*]`), 33+max(511, `c->synth_buf_offset[*]`)] + 128) Size: 2 by call to `ff_mpa_synth_filter`. libavcodec/mpc.c:51:1: Parameter `c->synth_buf[*]` 49. * Process decoded Musepack data and produce PCM 50. */ 51. static void mpc_synth(MPCContext *c, int16_t *out) ^ 52. { 53. int dither_state = 0; libavcodec/mpc.c:60:13: Call 58. samples_ptr = samples + ch; 59. for(i = 0; i < SAMPLES_PER_BAND; i++) { 60. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), ^ 61. mpa_window, &dither_state, 62. samples_ptr, 2, libavcodec/mpegaudiodec.c:858:1: <Length trace> 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:858:1: Parameter `*synth_buf_ptr` 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:877:5: Assignment 875. 876. offset = *synth_buf_offset; 877. synth_buf = synth_buf_ptr + offset; ^ 878. 879. for(j=0;j<32;j++) { libavcodec/mpegaudiodec.c:922:5: Assignment 920. } 921. 922. p = synth_buf + 32; ^ 923. SUM8(sum, -=, w + 32, p); 924. *samples = round_sample(&sum); libavcodec/mpegaudiodec.c:923:5: Array access: Offset: [160+min(0, c->synth_buf_offset[*]), 161+max(511, c->synth_buf_offset[*])] (⇐ [32+min(0, c->synth_buf_offset[*]), 33+max(511, c->synth_buf_offset[*])] + 128) Size: 2 by call to `ff_mpa_synth_filter` 921. 922. p = synth_buf + 32; 923. SUM8(sum, -=, w + 32, p); ^ 924. *samples = round_sample(&sum); 925. *dither_state= sum;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L923
d2a_code_trace_data_45902
static void av_update_stream_timings(AVFormatContext *ic) { int64_t start_time, start_time1, end_time, end_time1; int64_t duration, duration1; int i; AVStream *st; start_time = INT64_MAX; end_time = INT64_MIN; duration = INT64_MIN; for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->start_time != AV_NOPTS_VALUE && st->time_base.den) { start_time1= av_rescale_q(st->start_time, st->time_base, AV_TIME_BASE_Q); if (start_time1 < start_time) start_time = start_time1; if (st->duration != AV_NOPTS_VALUE) { end_time1 = start_time1 + av_rescale_q(st->duration, st->time_base, AV_TIME_BASE_Q); if (end_time1 > end_time) end_time = end_time1; } } if (st->duration != AV_NOPTS_VALUE) { duration1 = av_rescale_q(st->duration, st->time_base, AV_TIME_BASE_Q); if (duration1 > duration) duration = duration1; } } if (start_time != INT64_MAX) { ic->start_time = start_time; if (end_time != INT64_MIN) { if (end_time - start_time > duration) duration = end_time - start_time; } } if (duration != INT64_MIN) { ic->duration = duration; if (ic->file_size > 0) { ic->bit_rate = (double)ic->file_size * 8.0 * AV_TIME_BASE / (double)ic->duration; } } } libavformat/utils.c:1472: error: Integer Overflow L2 ([-9223372036854775807, +oo] - [-oo, 9223372036854775806]):signed64. libavformat/utils.c:1448:5: <LHS trace> 1446. 1447. start_time = INT64_MAX; 1448. end_time = INT64_MIN; ^ 1449. duration = INT64_MIN; 1450. for(i = 0;i < ic->nb_streams; i++) { libavformat/utils.c:1448:5: Assignment 1446. 1447. start_time = INT64_MAX; 1448. end_time = INT64_MIN; ^ 1449. duration = INT64_MIN; 1450. for(i = 0;i < ic->nb_streams; i++) { libavformat/utils.c:1447:5: <RHS trace> 1445. AVStream *st; 1446. 1447. start_time = INT64_MAX; ^ 1448. end_time = INT64_MIN; 1449. duration = INT64_MIN; libavformat/utils.c:1447:5: Assignment 1445. AVStream *st; 1446. 1447. start_time = INT64_MAX; ^ 1448. end_time = INT64_MIN; 1449. duration = INT64_MIN; libavformat/utils.c:1472:17: Binary operation: ([-9223372036854775807, +oo] - [-oo, 9223372036854775806]):signed64 1470. ic->start_time = start_time; 1471. if (end_time != INT64_MIN) { 1472. if (end_time - start_time > duration) ^ 1473. duration = end_time - start_time; 1474. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/utils.c/#L1472
d2a_code_trace_data_45903
static void print_leak(const MEM *m, MEM_LEAK *l) { char buf[1024]; char *bufp = buf; APP_INFO *amip; int ami_cnt; struct tm *lcl = NULL; unsigned long ti; if(m->addr == (char *)l->bio) return; if (options & V_CRYPTO_MDEBUG_TIME) { lcl = localtime(&m->time); sprintf(bufp, "[%02d:%02d:%02d] ", lcl->tm_hour,lcl->tm_min,lcl->tm_sec); bufp += strlen(bufp); } sprintf(bufp, "%5lu file=%s, line=%d, ", m->order,m->file,m->line); bufp += strlen(bufp); if (options & V_CRYPTO_MDEBUG_THREAD) { sprintf(bufp, "thread=%lu, ", m->thread); bufp += strlen(bufp); } sprintf(bufp, "number=%d, address=%08lX\n", m->num,(unsigned long)m->addr); bufp += strlen(bufp); BIO_puts(l->bio,buf); l->chunks++; l->bytes+=m->num; amip=m->app_info; ami_cnt=0; if (!amip) return; ti=amip->thread; do { int buf_len; int info_len; ami_cnt++; memset(buf,'>',ami_cnt); sprintf(buf + ami_cnt, " thread=%lu, file=%s, line=%d, info=\"", amip->thread, amip->file, amip->line); buf_len=strlen(buf); info_len=strlen(amip->info); if (128 - buf_len - 3 < info_len) { memcpy(buf + buf_len, amip->info, 128 - buf_len - 3); buf_len = 128 - 3; } else { strcpy(buf + buf_len, amip->info); buf_len = strlen(buf); } sprintf(buf + buf_len, "\"\n"); BIO_puts(l->bio,buf); amip = amip->next; } while(amip && amip->thread == ti); #ifdef LEVITTE_DEBUG_MEM if (amip) { fprintf(stderr, "Thread switch detected in backtrace!!!!\n"); abort(); } #endif } crypto/mem_dbg.c:608: error: NULL_DEREFERENCE pointer `lcl` last assigned on line 605 could be null and is dereferenced at line 608, column 4. Showing all 7 steps of the trace crypto/mem_dbg.c:591:1: start of procedure print_leak() 589. } MEM_LEAK; 590. 591. > static void print_leak(const MEM *m, MEM_LEAK *l) 592. { 593. char buf[1024]; crypto/mem_dbg.c:594:2: 592. { 593. char buf[1024]; 594. > char *bufp = buf; 595. APP_INFO *amip; 596. int ami_cnt; crypto/mem_dbg.c:597:2: 595. APP_INFO *amip; 596. int ami_cnt; 597. > struct tm *lcl = NULL; 598. unsigned long ti; 599. crypto/mem_dbg.c:600:5: Taking false branch 598. unsigned long ti; 599. 600. if(m->addr == (char *)l->bio) ^ 601. return; 602. crypto/mem_dbg.c:603:6: Taking true branch 601. return; 602. 603. if (options & V_CRYPTO_MDEBUG_TIME) ^ 604. { 605. lcl = localtime(&m->time); crypto/mem_dbg.c:605:3: 603. if (options & V_CRYPTO_MDEBUG_TIME) 604. { 605. > lcl = localtime(&m->time); 606. 607. sprintf(bufp, "[%02d:%02d:%02d] ", crypto/mem_dbg.c:607:3: 605. lcl = localtime(&m->time); 606. 607. > sprintf(bufp, "[%02d:%02d:%02d] ", 608. lcl->tm_hour,lcl->tm_min,lcl->tm_sec); 609. bufp += strlen(bufp);
https://github.com/openssl/openssl/blob/a1d85309ee183c97a5ee4f8277f17d87d7786e25/crypto/mem_dbg.c/#L608
d2a_code_trace_data_45904
static void copy_flags(BIO *bio) { int flags; BIO *next = BIO_next(bio); flags = BIO_test_flags(next, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_RWS); BIO_clear_flags(bio, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_RWS); BIO_set_flags(bio, flags); } test/ssltestlib.c:73: error: NULL_DEREFERENCE pointer `next` last assigned on line 71 could be null and is dereferenced by call to `BIO_test_flags()` at line 73, column 13. Showing all 9 steps of the trace test/ssltestlib.c:68:1: start of procedure copy_flags() 66. } 67. 68. > static void copy_flags(BIO *bio) 69. { 70. int flags; test/ssltestlib.c:71:5: 69. { 70. int flags; 71. > BIO *next = BIO_next(bio); 72. 73. flags = BIO_test_flags(next, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_RWS); crypto/bio/bio_lib.c:670:1: start of procedure BIO_next() 668. } 669. 670. > BIO *BIO_next(BIO *b) 671. { 672. if (b == NULL) crypto/bio/bio_lib.c:672:9: Taking true branch 670. BIO *BIO_next(BIO *b) 671. { 672. if (b == NULL) ^ 673. return NULL; 674. return b->next_bio; crypto/bio/bio_lib.c:673:9: 671. { 672. if (b == NULL) 673. > return NULL; 674. return b->next_bio; 675. } crypto/bio/bio_lib.c:675:1: return from a call to BIO_next 673. return NULL; 674. return b->next_bio; 675. > } 676. 677. void BIO_set_next(BIO *b, BIO *next) test/ssltestlib.c:73:5: 71. BIO *next = BIO_next(bio); 72. 73. > flags = BIO_test_flags(next, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_RWS); 74. BIO_clear_flags(bio, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_RWS); 75. BIO_set_flags(bio, flags); crypto/bio/bio_lib.c:194:1: start of procedure BIO_test_flags() 192. } 193. 194. > int BIO_test_flags(const BIO *b, int flags) 195. { 196. return (b->flags & flags); crypto/bio/bio_lib.c:196:5: 194. int BIO_test_flags(const BIO *b, int flags) 195. { 196. > return (b->flags & flags); 197. } 198.
https://github.com/openssl/openssl/blob/cbe952418376a25acd872db4281a0b09735001f1/test/ssltestlib.c/#L73
d2a_code_trace_data_45905
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecdsa_ossl.c:273: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`. Showing all 17 steps of the trace crypto/ec/ecdsa_ossl.c:260:18: Call 258. do { 259. if (in_kinv == NULL || in_r == NULL) { 260. if (!ecdsa_sign_setup(eckey, ctx, &kinv, &ret->r, dgst, dgst_len)) { ^ 261. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_ECDSA_LIB); 262. goto err; crypto/ec/ecdsa_ossl.c:34:1: Parameter `ctx_in->stack.depth` 32. } 33. 34. > static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, 35. BIGNUM **kinvp, BIGNUM **rp, 36. const unsigned char *dgst, int dlen) crypto/ec/ecdsa_ossl.c:273:14: Call 271. } 272. 273. if (!BN_mod_mul(tmp, priv_key, ret->r, order, ctx)) { ^ 274. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); 275. goto err; crypto/bn/bn_mod.c:73:1: Parameter `ctx->stack.depth` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/bn/bn_mod.c:83:5: Call 81. bn_check_top(m); 82. 83. BN_CTX_start(ctx); ^ 84. if ((t = BN_CTX_get(ctx)) == NULL) 85. goto err; crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mod.c:87:14: Call 85. goto err; 86. if (a == b) { 87. if (!BN_sqr(t, a, ctx)) ^ 88. goto err; 89. } else { crypto/bn/bn_sqr.c:32:5: Call 30. } 31. 32. BN_CTX_start(ctx); ^ 33. rr = (a != r) ? r : BN_CTX_get(ctx); 34. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_sqr.c:100:5: Call 98. bn_check_top(rr); 99. bn_check_top(tmp); 100. BN_CTX_end(ctx); ^ 101. return (ret); 102. } crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <Offset trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: <Length trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/d7c42d71ba407a4b3c26ed58263ae225976bbac3/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_45906
static int opt_streamid(const char *opt, const char *arg) { int idx; char *p; char idx_str[16]; strncpy(idx_str, arg, sizeof(idx_str)); idx_str[sizeof(idx_str)-1] = '\0'; p = strchr(idx_str, ':'); if (!p) { fprintf(stderr, "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", arg, opt); ffmpeg_exit(1); } *p++ = '\0'; idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1); streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1); streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); return 0; } ffmpeg.c:3656: error: Null Dereference pointer `p` last assigned on line 3656 could be null and is dereferenced at line 3656, column 5. ffmpeg.c:3641:1: start of procedure opt_streamid() 3639. 3640. /* arg format is "output-stream-index:streamid-value". */ 3641. static int opt_streamid(const char *opt, const char *arg) ^ 3642. { 3643. int idx; ffmpeg.c:3647:5: 3645. char idx_str[16]; 3646. 3647. strncpy(idx_str, arg, sizeof(idx_str)); ^ 3648. idx_str[sizeof(idx_str)-1] = '\0'; 3649. p = strchr(idx_str, ':'); ffmpeg.c:3648:5: 3646. 3647. strncpy(idx_str, arg, sizeof(idx_str)); 3648. idx_str[sizeof(idx_str)-1] = '\0'; ^ 3649. p = strchr(idx_str, ':'); 3650. if (!p) { ffmpeg.c:3649:5: 3647. strncpy(idx_str, arg, sizeof(idx_str)); 3648. idx_str[sizeof(idx_str)-1] = '\0'; 3649. p = strchr(idx_str, ':'); ^ 3650. if (!p) { 3651. fprintf(stderr, ffmpeg.c:3650:10: Taking true branch 3648. idx_str[sizeof(idx_str)-1] = '\0'; 3649. p = strchr(idx_str, ':'); 3650. if (!p) { ^ 3651. fprintf(stderr, 3652. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", ffmpeg.c:3651:9: 3649. p = strchr(idx_str, ':'); 3650. if (!p) { 3651. fprintf(stderr, ^ 3652. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", 3653. arg, opt); ffmpeg.c:3654:9: Skipping ffmpeg_exit(): empty list of specs 3652. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", 3653. arg, opt); 3654. ffmpeg_exit(1); ^ 3655. } 3656. *p++ = '\0'; ffmpeg.c:3656:5: 3654. ffmpeg_exit(1); 3655. } 3656. *p++ = '\0'; ^ 3657. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1); 3658. streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
https://github.com/libav/libav/blob/129983408d0d064db656742a3d3d4c038420f48c/ffmpeg.c/#L3656
d2a_code_trace_data_45907
static int flac_header (AVFormatContext * s, int idx) { ogg_t *ogg = s->priv_data; ogg_stream_t *os = ogg->streams + idx; AVStream *st = s->streams[idx]; GetBitContext gb; int mdt; if (os->buf[os->pstart] == 0xff) return 0; init_get_bits(&gb, os->buf + os->pstart, os->psize*8); get_bits(&gb, 1); mdt = get_bits(&gb, 7); if (mdt == 0x7f) { skip_bits(&gb, 4*8); if(get_bits(&gb, 8) != 1) return -1; skip_bits(&gb, 8 + 16); skip_bits(&gb, 4*8); if (get_bits_long(&gb, 32) != FLAC_STREAMINFO_SIZE) return -1; skip_bits(&gb, 16*2+24*2); st->codec->sample_rate = get_bits_long(&gb, 20); st->codec->channels = get_bits(&gb, 3) + 1; st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_FLAC; st->codec->extradata = av_malloc(FLAC_STREAMINFO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); memcpy (st->codec->extradata, os->buf + os->pstart + 5 + 4 + 4 + 4, FLAC_STREAMINFO_SIZE); st->codec->extradata_size = FLAC_STREAMINFO_SIZE; st->time_base.num = 1; st->time_base.den = st->codec->sample_rate; } else if (mdt == 4) { vorbis_comment (s, os->buf + os->pstart + 4, os->psize - 4); } return 1; } libavformat/oggparseflac.c:72: error: Integer Overflow L2 ([0, +oo] - 4):unsigned32. libavformat/oggparseflac.c:41:5: <LHS trace> 39. 40. init_get_bits(&gb, os->buf + os->pstart, os->psize*8); 41. get_bits(&gb, 1); /* metadata_last */ ^ 42. mdt = get_bits(&gb, 7); 43. libavformat/oggparseflac.c:41:5: Call 39. 40. init_get_bits(&gb, os->buf + os->pstart, os->psize*8); 41. get_bits(&gb, 1); /* metadata_last */ ^ 42. mdt = get_bits(&gb, 7); 43. libavcodec/bitstream.h:655:1: Parameter `*s->buffer` 653. * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't 654. */ 655. static inline unsigned int get_bits(GetBitContext *s, int n){ ^ 656. register int tmp; 657. OPEN_READER(re, s) libavformat/oggparseflac.c:42:11: Call 40. init_get_bits(&gb, os->buf + os->pstart, os->psize*8); 41. get_bits(&gb, 1); /* metadata_last */ 42. mdt = get_bits(&gb, 7); ^ 43. 44. if (mdt == 0x7f) { libavcodec/bitstream.h:655:1: Parameter `*s->buffer` 653. * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't 654. */ 655. static inline unsigned int get_bits(GetBitContext *s, int n){ ^ 656. register int tmp; 657. OPEN_READER(re, s) libavformat/oggparseflac.c:72:9: Binary operation: ([0, +oo] - 4):unsigned32 70. st->time_base.den = st->codec->sample_rate; 71. } else if (mdt == 4) { 72. vorbis_comment (s, os->buf + os->pstart + 4, os->psize - 4); ^ 73. } 74.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/oggparseflac.c/#L72
d2a_code_trace_data_45908
ERR_STATE *ERR_get_state(void) { ERR_STATE *state; int saveerrno = get_last_sys_error(); if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL)) return NULL; if (!RUN_ONCE(&err_init, err_do_init)) return NULL; state = CRYPTO_THREAD_get_local(&err_thread_local); if (state == (ERR_STATE*)-1) return NULL; if (state == NULL) { if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1)) return NULL; if ((state = OPENSSL_zalloc(sizeof(*state))) == NULL) { CRYPTO_THREAD_set_local(&err_thread_local, NULL); return NULL; } if (!ossl_init_thread_start(NULL, NULL, err_delete_thread_state) || !CRYPTO_THREAD_set_local(&err_thread_local, state)) { ERR_STATE_free(state); CRYPTO_THREAD_set_local(&err_thread_local, NULL); return NULL; } OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL); } set_sys_error(saveerrno); return state; } crypto/err/err.c:716: error: NULL_DEREFERENCE pointer `null` is dereferenced by call to `ossl_init_thread_start()` at line 716, column 14. Showing all 28 steps of the trace crypto/err/err.c:692:1: start of procedure ERR_get_state() 690. } 691. 692. > ERR_STATE *ERR_get_state(void) 693. { 694. ERR_STATE *state; crypto/err/err.c:695:5: 693. { 694. ERR_STATE *state; 695. > int saveerrno = get_last_sys_error(); 696. 697. if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL)) crypto/err/err.c:697:10: Taking false branch 695. int saveerrno = get_last_sys_error(); 696. 697. if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL)) ^ 698. return NULL; 699. crypto/err/err.c:700:10: 698. return NULL; 699. 700. > if (!RUN_ONCE(&err_init, err_do_init)) 701. return NULL; 702. crypto/threads_pthread.c:111:1: start of procedure CRYPTO_THREAD_run_once() 109. } 110. 111. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 112. { 113. if (pthread_once(once, init) != 0) crypto/threads_pthread.c:113:9: Taking false branch 111. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 112. { 113. if (pthread_once(once, init) != 0) ^ 114. return 0; 115. crypto/threads_pthread.c:116:5: 114. return 0; 115. 116. > return 1; 117. } 118. crypto/threads_pthread.c:117:1: return from a call to CRYPTO_THREAD_run_once 115. 116. return 1; 117. > } 118. 119. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/err/err.c:700:10: Condition is true 698. return NULL; 699. 700. if (!RUN_ONCE(&err_init, err_do_init)) ^ 701. return NULL; 702. crypto/err/err.c:700:10: Taking false branch 698. return NULL; 699. 700. if (!RUN_ONCE(&err_init, err_do_init)) ^ 701. return NULL; 702. crypto/err/err.c:703:5: 701. return NULL; 702. 703. > state = CRYPTO_THREAD_get_local(&err_thread_local); 704. if (state == (ERR_STATE*)-1) 705. return NULL; crypto/threads_pthread.c:127:1: start of procedure CRYPTO_THREAD_get_local() 125. } 126. 127. > void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 128. { 129. return pthread_getspecific(*key); crypto/threads_pthread.c:129:5: Skipping pthread_getspecific(): method has no implementation 127. void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 128. { 129. return pthread_getspecific(*key); ^ 130. } 131. crypto/threads_pthread.c:130:1: return from a call to CRYPTO_THREAD_get_local 128. { 129. return pthread_getspecific(*key); 130. > } 131. 132. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) crypto/err/err.c:704:9: Taking false branch 702. 703. state = CRYPTO_THREAD_get_local(&err_thread_local); 704. if (state == (ERR_STATE*)-1) ^ 705. return NULL; 706. crypto/err/err.c:707:9: Taking true branch 705. return NULL; 706. 707. if (state == NULL) { ^ 708. if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1)) 709. return NULL; crypto/err/err.c:708:14: 706. 707. if (state == NULL) { 708. > if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1)) 709. return NULL; 710. crypto/threads_pthread.c:132:1: start of procedure CRYPTO_THREAD_set_local() 130. } 131. 132. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 133. { 134. if (pthread_setspecific(*key, val) != 0) crypto/threads_pthread.c:134:9: Taking false branch 132. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 133. { 134. if (pthread_setspecific(*key, val) != 0) ^ 135. return 0; 136. crypto/threads_pthread.c:137:5: 135. return 0; 136. 137. > return 1; 138. } 139. crypto/threads_pthread.c:138:1: return from a call to CRYPTO_THREAD_set_local 136. 137. return 1; 138. > } 139. 140. int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key) crypto/err/err.c:708:14: Taking false branch 706. 707. if (state == NULL) { 708. if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1)) ^ 709. return NULL; 710. crypto/err/err.c:711:13: 709. return NULL; 710. 711. > if ((state = OPENSSL_zalloc(sizeof(*state))) == NULL) { 712. CRYPTO_THREAD_set_local(&err_thread_local, NULL); 713. return NULL; providers/fips/fipsprov.c:460:1: start of procedure CRYPTO_zalloc() 458. } 459. 460. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 461. { 462. return c_CRYPTO_zalloc(num, file, line); providers/fips/fipsprov.c:462:5: Skipping __function_pointer__(): unresolved function pointer 460. void *CRYPTO_zalloc(size_t num, const char *file, int line) 461. { 462. return c_CRYPTO_zalloc(num, file, line); ^ 463. } 464. providers/fips/fipsprov.c:463:1: return from a call to CRYPTO_zalloc 461. { 462. return c_CRYPTO_zalloc(num, file, line); 463. > } 464. 465. void CRYPTO_free(void *ptr, const char *file, int line) crypto/err/err.c:711:13: Taking false branch 709. return NULL; 710. 711. if ((state = OPENSSL_zalloc(sizeof(*state))) == NULL) { ^ 712. CRYPTO_THREAD_set_local(&err_thread_local, NULL); 713. return NULL; crypto/err/err.c:716:14: 714. } 715. 716. > if (!ossl_init_thread_start(NULL, NULL, err_delete_thread_state) 717. || !CRYPTO_THREAD_set_local(&err_thread_local, state)) { 718. ERR_STATE_free(state);
https://github.com/openssl/openssl/blob/11dbdc0714b117fcac4af59d61184b0770fcee7e/crypto/err/err.c/#L716
d2a_code_trace_data_45909
void CRYPTO_free(void *str, const char *file, int line) { INCREMENT(free_count); if (free_impl != NULL && free_impl != &CRYPTO_free) { free_impl(str, file, line); return; } #ifndef OPENSSL_NO_CRYPTO_MDEBUG if (call_malloc_debug) { CRYPTO_mem_debug_free(str, 0, file, line); free(str); CRYPTO_mem_debug_free(str, 1, file, line); } else { free(str); } #else free(str); #endif } apps/s_client.c:557: error: USE_AFTER_FREE call to `tlsa_import_rr()` eventually accesses memory that was invalidated by call to `free()` on line 557 indirectly during the call to `tlsa_import_rr()`. Showing all 14 steps of the trace apps/s_client.c:557:13: invalidation part of the trace starts here 555. for (i = 0; i < num; ++i) { 556. char *rrdata = sk_OPENSSL_STRING_value(rrset, i); 557. if (tlsa_import_rr(con, rrdata) > 0) ^ 558. ++count; 559. } apps/s_client.c:557:13: global variable `tlsa_import_rr.data` accessed here 555. for (i = 0; i < num; ++i) { 556. char *rrdata = sk_OPENSSL_STRING_value(rrset, i); 557. if (tlsa_import_rr(con, rrdata) > 0) ^ 558. ++count; 559. } apps/s_client.c:557:13: when calling `tlsa_import_rr` here 555. for (i = 0; i < num; ++i) { 556. char *rrdata = sk_OPENSSL_STRING_value(rrset, i); 557. if (tlsa_import_rr(con, rrdata) > 0) ^ 558. ++count; 559. } apps/s_client.c:514:9: global variable `tlsa_import_rr.data` accessed here 512. { &selector, "selector", checked_uint8 }, 513. { &mtype, "mtype", checked_uint8 }, 514. { &data, "data", hexdecode }, ^ 515. { NULL, } 516. }; apps/s_client.c:532:5: when calling `CRYPTO_free` here 530. /* The data field is last, so len is its length */ 531. ret = SSL_dane_tlsa_add(con, usage, selector, mtype, data, len); 532. OPENSSL_free(data); ^ 533. 534. if (ret == 0) { crypto/mem.c:295:1: parameter `str` of CRYPTO_free 293. } 294. 295. > void CRYPTO_free(void *str, const char *file, int line) 296. { 297. INCREMENT(free_count); crypto/mem.c:312:5: was invalidated by call to `free()` 310. } 311. #else 312. free(str); ^ 313. #endif 314. } apps/s_client.c:557:13: use-after-lifetime part of the trace starts here 555. for (i = 0; i < num; ++i) { 556. char *rrdata = sk_OPENSSL_STRING_value(rrset, i); 557. if (tlsa_import_rr(con, rrdata) > 0) ^ 558. ++count; 559. } apps/s_client.c:557:13: global variable `tlsa_import_rr.data` accessed here 555. for (i = 0; i < num; ++i) { 556. char *rrdata = sk_OPENSSL_STRING_value(rrset, i); 557. if (tlsa_import_rr(con, rrdata) > 0) ^ 558. ++count; 559. } apps/s_client.c:557:13: when calling `tlsa_import_rr` here 555. for (i = 0; i < num; ++i) { 556. char *rrdata = sk_OPENSSL_STRING_value(rrset, i); 557. if (tlsa_import_rr(con, rrdata) > 0) ^ 558. ++count; 559. } apps/s_client.c:514:9: global variable `tlsa_import_rr.data` accessed here 512. { &selector, "selector", checked_uint8 }, 513. { &mtype, "mtype", checked_uint8 }, 514. { &data, "data", hexdecode }, ^ 515. { NULL, } 516. }; apps/s_client.c:532:5: when calling `CRYPTO_free` here 530. /* The data field is last, so len is its length */ 531. ret = SSL_dane_tlsa_add(con, usage, selector, mtype, data, len); 532. OPENSSL_free(data); ^ 533. 534. if (ret == 0) { crypto/mem.c:295:1: parameter `str` of CRYPTO_free 293. } 294. 295. > void CRYPTO_free(void *str, const char *file, int line) 296. { 297. INCREMENT(free_count); crypto/mem.c:312:5: invalid access occurs here 310. } 311. #else 312. free(str); ^ 313. #endif 314. }
https://github.com/openssl/openssl/blob/e613b1eff40f21cd99240f9884cd3396b0ab50f1/crypto/mem.c/#L312
d2a_code_trace_data_45910
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) { OutputStream *ost; AVStream *st = avformat_new_stream(oc, NULL); int idx = oc->nb_streams - 1, ret = 0; int64_t max_frames = INT64_MAX; char *bsf = NULL, *next, *codec_tag = NULL; AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; double qscale = -1; char *buf = NULL, *arg = NULL, *preset = NULL; AVIOContext *s = NULL; if (!st) { av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); exit_program(1); } if (oc->nb_streams - 1 < o->nb_streamid_map) st->id = o->streamid_map[oc->nb_streams - 1]; output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams, nb_output_streams + 1); ost = &output_streams[nb_output_streams - 1]; ost->file_index = nb_output_files; ost->index = idx; ost->st = st; st->codec->codec_type = type; choose_encoder(o, oc, ost); if (ost->enc) { ost->opts = filter_codec_opts(codec_opts, ost->enc->id, oc, st); } avcodec_get_context_defaults3(st->codec, ost->enc); st->codec->codec_type = type; MATCH_PER_STREAM_OPT(presets, str, preset, oc, st); if (preset && (!(ret = get_preset_file_2(preset, ost->enc->name, &s)))) { do { buf = get_line(s); if (!buf[0] || buf[0] == '#') { av_free(buf); continue; } if (!(arg = strchr(buf, '='))) { av_log(NULL, AV_LOG_FATAL, "Invalid line found in the preset file.\n"); exit_program(1); } *arg++ = 0; av_dict_set(&ost->opts, buf, arg, AV_DICT_DONT_OVERWRITE); av_free(buf); } while (!s->eof_reached); avio_close(s); } if (ret) { av_log(NULL, AV_LOG_FATAL, "Preset %s specified for stream %d:%d, but could not be opened.\n", preset, ost->file_index, ost->index); exit_program(1); } MATCH_PER_STREAM_OPT(max_frames, i64, max_frames, oc, st); ost->max_frames = max_frames; MATCH_PER_STREAM_OPT(bitstream_filters, str, bsf, oc, st); while (bsf) { if (next = strchr(bsf, ',')) *next++ = 0; if (!(bsfc = av_bitstream_filter_init(bsf))) { av_log(NULL, AV_LOG_FATAL, "Unknown bitstream filter %s\n", bsf); exit_program(1); } if (bsfc_prev) bsfc_prev->next = bsfc; else ost->bitstream_filters = bsfc; bsfc_prev = bsfc; bsf = next; } MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, oc, st); if (codec_tag) { uint32_t tag = strtol(codec_tag, &next, 0); if (*next) tag = AV_RL32(codec_tag); st->codec->codec_tag = tag; } MATCH_PER_STREAM_OPT(qscale, dbl, qscale, oc, st); if (qscale >= 0 || same_quant) { st->codec->flags |= CODEC_FLAG_QSCALE; st->codec->global_quality = FF_QP2LAMBDA * qscale; } if (oc->oformat->flags & AVFMT_GLOBALHEADER) st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; av_opt_get_int(sws_opts, "sws_flags", 0, &ost->sws_flags); return ost; } avconv.c:3038: error: Null Dereference pointer `st` last assigned on line 3023 could be null and is dereferenced at line 3038, column 9. avconv.c:3020:1: start of procedure new_output_stream() 3018. } 3019. 3020. static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) ^ 3021. { 3022. OutputStream *ost; avconv.c:3023:5: 3021. { 3022. OutputStream *ost; 3023. AVStream *st = avformat_new_stream(oc, NULL); ^ 3024. int idx = oc->nb_streams - 1, ret = 0; 3025. int64_t max_frames = INT64_MAX; libavformat/utils.c:2663:1: start of procedure avformat_new_stream() 2661. #endif 2662. 2663. AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c) ^ 2664. { 2665. AVStream *st; libavformat/utils.c:2669:9: Taking true branch 2667. AVStream **streams; 2668. 2669. if (s->nb_streams >= INT_MAX/sizeof(*streams)) ^ 2670. return NULL; 2671. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); libavformat/utils.c:2670:9: 2668. 2669. if (s->nb_streams >= INT_MAX/sizeof(*streams)) 2670. return NULL; ^ 2671. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); 2672. if (!streams) libavformat/utils.c:2711:1: return from a call to avformat_new_stream 2709. s->streams[s->nb_streams++] = st; 2710. return st; 2711. } ^ 2712. 2713. AVProgram *av_new_program(AVFormatContext *ac, int id) avconv.c:3024:5: 3022. OutputStream *ost; 3023. AVStream *st = avformat_new_stream(oc, NULL); 3024. int idx = oc->nb_streams - 1, ret = 0; ^ 3025. int64_t max_frames = INT64_MAX; 3026. char *bsf = NULL, *next, *codec_tag = NULL; avconv.c:3025:5: 3023. AVStream *st = avformat_new_stream(oc, NULL); 3024. int idx = oc->nb_streams - 1, ret = 0; 3025. int64_t max_frames = INT64_MAX; ^ 3026. char *bsf = NULL, *next, *codec_tag = NULL; 3027. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; avconv.c:3026:5: 3024. int idx = oc->nb_streams - 1, ret = 0; 3025. int64_t max_frames = INT64_MAX; 3026. char *bsf = NULL, *next, *codec_tag = NULL; ^ 3027. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; 3028. double qscale = -1; avconv.c:3027:5: 3025. int64_t max_frames = INT64_MAX; 3026. char *bsf = NULL, *next, *codec_tag = NULL; 3027. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; ^ 3028. double qscale = -1; 3029. char *buf = NULL, *arg = NULL, *preset = NULL; avconv.c:3028:5: 3026. char *bsf = NULL, *next, *codec_tag = NULL; 3027. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; 3028. double qscale = -1; ^ 3029. char *buf = NULL, *arg = NULL, *preset = NULL; 3030. AVIOContext *s = NULL; avconv.c:3029:5: 3027. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; 3028. double qscale = -1; 3029. char *buf = NULL, *arg = NULL, *preset = NULL; ^ 3030. AVIOContext *s = NULL; 3031. avconv.c:3030:5: 3028. double qscale = -1; 3029. char *buf = NULL, *arg = NULL, *preset = NULL; 3030. AVIOContext *s = NULL; ^ 3031. 3032. if (!st) { avconv.c:3032:10: Taking true branch 3030. AVIOContext *s = NULL; 3031. 3032. if (!st) { ^ 3033. av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); 3034. exit_program(1); avconv.c:3033:9: Skipping av_log(): empty list of specs 3031. 3032. if (!st) { 3033. av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); ^ 3034. exit_program(1); 3035. } avconv.c:3034:9: Skipping exit_program(): empty list of specs 3032. if (!st) { 3033. av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); 3034. exit_program(1); ^ 3035. } 3036. avconv.c:3037:9: Taking true branch 3035. } 3036. 3037. if (oc->nb_streams - 1 < o->nb_streamid_map) ^ 3038. st->id = o->streamid_map[oc->nb_streams - 1]; 3039. avconv.c:3038:9: 3036. 3037. if (oc->nb_streams - 1 < o->nb_streamid_map) 3038. st->id = o->streamid_map[oc->nb_streams - 1]; ^ 3039. 3040. output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,
https://github.com/libav/libav/blob/8664682d0e6b6071ca7b3f6b9e350305d3fbcf76/avconv.c/#L3038
d2a_code_trace_data_45911
static char * ngx_http_geo_add_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, in_addr_t start, in_addr_t end) { in_addr_t n; ngx_uint_t h, i, s, e; ngx_array_t *a; ngx_http_geo_range_t *range; for (n = start; n <= end; n += 0x10000) { h = n >> 16; if (n == start) { s = n & 0xffff; } else { s = 0; } if ((n | 0xffff) > end) { e = end & 0xffff; } else { e = 0xffff; } a = (ngx_array_t *) ctx->high->low[h].ranges; if (a == NULL) { a = ngx_array_create(ctx->temp_pool, 64, sizeof(ngx_http_geo_range_t)); if (a == NULL) { return NGX_CONF_ERROR; } ctx->high->low[h].ranges = (ngx_http_geo_range_t *) a; } i = a->nelts; range = a->elts; while (i) { i--; if (e < (ngx_uint_t) range[i].start) { continue; } if (s > (ngx_uint_t) range[i].end) { range = ngx_array_push(a); if (range == NULL) { return NGX_CONF_ERROR; } range = a->elts; ngx_memcpy(&range[i + 2], &range[i + 1], (a->nelts - 2 - i) * sizeof(ngx_http_geo_range_t)); range[i + 1].start = (u_short) s; range[i + 1].end = (u_short) e; range[i + 1].value = ctx->value; goto next; } if (s == (ngx_uint_t) range[i].start && e == (ngx_uint_t) range[i].end) { ngx_conf_log_error(NGX_LOG_WARN, cf, 0, "duplicate range \"%V\", value: \"%v\", old value: \"%v\"", ctx->net, ctx->value, range[i].value); range[i].value = ctx->value; goto next; } if (s > (ngx_uint_t) range[i].start && e < (ngx_uint_t) range[i].end) { range = ngx_array_push(a); if (range == NULL) { return NGX_CONF_ERROR; } range = ngx_array_push(a); if (range == NULL) { return NGX_CONF_ERROR; } range = a->elts; ngx_memcpy(&range[i + 3], &range[i + 1], (a->nelts - 3 - i) * sizeof(ngx_http_geo_range_t)); range[i + 2].start = (u_short) (e + 1); range[i + 2].end = range[i].end; range[i + 2].value = range[i].value; range[i + 1].start = (u_short) s; range[i + 1].end = (u_short) e; range[i + 1].value = ctx->value; range[i].end = (u_short) (s - 1); goto next; } if (s == (ngx_uint_t) range[i].start && e < (ngx_uint_t) range[i].end) { range = ngx_array_push(a); if (range == NULL) { return NGX_CONF_ERROR; } range = a->elts; ngx_memcpy(&range[i + 1], &range[i], (a->nelts - 1 - i) * sizeof(ngx_http_geo_range_t)); range[i + 1].start = (u_short) (e + 1); range[i].start = (u_short) s; range[i].end = (u_short) e; range[i].value = ctx->value; goto next; } if (s > (ngx_uint_t) range[i].start && e == (ngx_uint_t) range[i].end) { range = ngx_array_push(a); if (range == NULL) { return NGX_CONF_ERROR; } range = a->elts; ngx_memcpy(&range[i + 2], &range[i + 1], (a->nelts - 2 - i) * sizeof(ngx_http_geo_range_t)); range[i + 1].start = (u_short) s; range[i + 1].end = (u_short) e; range[i + 1].value = ctx->value; range[i].end = (u_short) (s - 1); goto next; } s = (ngx_uint_t) range[i].start; e = (ngx_uint_t) range[i].end; ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "range \"%V\" overlaps \"%d.%d.%d.%d-%d.%d.%d.%d\"", ctx->net, h >> 8, h & 0xff, s >> 8, s & 0xff, h >> 8, h & 0xff, e >> 8, e & 0xff); return NGX_CONF_ERROR; } range = ngx_array_push(a); if (range == NULL) { return NGX_CONF_ERROR; } range->start = (u_short) s; range->end = (u_short) e; range->value = ctx->value; next: continue; } return NGX_CONF_OK; } src/http/modules/ngx_http_geo_module.c:576: error: Integer Overflow L2 ([0, +oo] - 2):unsigned64. src/http/modules/ngx_http_geo_module.c:545:17: <LHS trace> 543. 544. if (a == NULL) { 545. a = ngx_array_create(ctx->temp_pool, 64, ^ 546. sizeof(ngx_http_geo_range_t)); 547. if (a == NULL) { src/http/modules/ngx_http_geo_module.c:545:17: Call 543. 544. if (a == NULL) { 545. a = ngx_array_create(ctx->temp_pool, 64, ^ 546. sizeof(ngx_http_geo_range_t)); 547. if (a == NULL) { src/core/ngx_array.c:26:5: Assignment 24. } 25. 26. a->nelts = 0; ^ 27. a->size = size; 28. a->nalloc = n; src/http/modules/ngx_http_geo_module.c:576:17: Binary operation: ([0, +oo] - 2):unsigned64 574. range = a->elts; 575. 576. ngx_memcpy(&range[i + 2], &range[i + 1], ^ 577. (a->nelts - 2 - i) * sizeof(ngx_http_geo_range_t)); 578.
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/http/modules/ngx_http_geo_module.c/#L576
d2a_code_trace_data_45912
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1176: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mul`. Showing all 10 steps of the trace test/bntest.c:1176:10: Call 1174. BN_zero(zero); 1175. 1176. if (!BN_mul(ret, a, b, ctx) ^ 1177. || !equalBN("A * B", product, ret) 1178. || !BN_div(ret, remainder, product, a, ctx) crypto/bn/bn_mul.c:828:1: Parameter `ctx->stack.depth` 826. #endif /* BN_RECURSION */ 827. 828. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 829. { 830. int ret = 0; crypto/bn/bn_mul.c:854:5: Call 852. top = al + bl; 853. 854. BN_CTX_start(ctx); ^ 855. if ((r == a) || (r == b)) { 856. if ((rr = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mul.c:979:5: Call 977. err: 978. bn_check_top(r); 979. BN_CTX_end(ctx); ^ 980. return (ret); 981. } crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <LHS trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mul` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_45913
static int ubsec_dh_generate_key(DH *dh) { int ret = 0, random_bits = 0, pub_key_len = 0, priv_key_len = 0, fd; BIGNUM *pub_key = NULL; BIGNUM *priv_key = NULL; if (dh->priv_key == NULL) { priv_key = BN_new(); if (priv_key == NULL) goto err; priv_key_len = BN_num_bits(dh->p); bn_wexpand(priv_key, dh->p->top); do if (!BN_rand_range(priv_key, dh->p)) goto err; while (BN_is_zero(priv_key)); random_bits = BN_num_bits(priv_key); } else { priv_key = dh->priv_key; } if (dh->pub_key == NULL) { pub_key = BN_new(); pub_key_len = BN_num_bits(dh->p); bn_wexpand(pub_key, dh->p->top); if(pub_key == NULL) goto err; } else { pub_key = dh->pub_key; } if ((fd = p_UBSEC_ubsec_open(UBSEC_KEY_DEVICE_NAME)) <= 0) { const DH_METHOD *meth; UBSECerr(UBSEC_F_UBSEC_DH_GENERATE_KEY, UBSEC_R_UNIT_FAILURE); meth = DH_OpenSSL(); ret = meth->generate_key(dh); goto err; } if (p_UBSEC_diffie_hellman_generate_ioctl(fd, (unsigned char *)priv_key->d, &priv_key_len, (unsigned char *)pub_key->d, &pub_key_len, (unsigned char *)dh->g->d, BN_num_bits(dh->g), (unsigned char *)dh->p->d, BN_num_bits(dh->p), 0, 0, random_bits) != 0) { const DH_METHOD *meth; UBSECerr(UBSEC_F_UBSEC_DH_GENERATE_KEY, UBSEC_R_REQUEST_FAILED); p_UBSEC_ubsec_close(fd); meth = DH_OpenSSL(); ret = meth->generate_key(dh); goto err; } p_UBSEC_ubsec_close(fd); dh->pub_key = pub_key; dh->pub_key->top = (pub_key_len + BN_BITS2-1) / BN_BITS2; dh->priv_key = priv_key; dh->priv_key->top = (priv_key_len + BN_BITS2-1) / BN_BITS2; ret = 1; err: return ret; } engines/e_ubsec.c:946: error: NULL_DEREFERENCE pointer `pub_key` last assigned on line 944 could be null and is dereferenced at line 946, column 17. Showing all 46 steps of the trace engines/e_ubsec.c:911:1: start of procedure ubsec_dh_generate_key() 909. } 910. 911. > static int ubsec_dh_generate_key(DH *dh) 912. { 913. int ret = 0, engines/e_ubsec.c:913:9: 911. static int ubsec_dh_generate_key(DH *dh) 912. { 913. > int ret = 0, 914. random_bits = 0, 915. pub_key_len = 0, engines/e_ubsec.c:918:9: 916. priv_key_len = 0, 917. fd; 918. > BIGNUM *pub_key = NULL; 919. BIGNUM *priv_key = NULL; 920. engines/e_ubsec.c:919:9: 917. fd; 918. BIGNUM *pub_key = NULL; 919. > BIGNUM *priv_key = NULL; 920. 921. /* engines/e_ubsec.c:926:13: Taking false branch 924. */ 925. 926. if (dh->priv_key == NULL) ^ 927. { 928. priv_key = BN_new(); engines/e_ubsec.c:939:17: 937. else 938. { 939. > priv_key = dh->priv_key; 940. } 941. engines/e_ubsec.c:942:13: Taking true branch 940. } 941. 942. if (dh->pub_key == NULL) ^ 943. { 944. pub_key = BN_new(); engines/e_ubsec.c:944:17: 942. if (dh->pub_key == NULL) 943. { 944. > pub_key = BN_new(); 945. pub_key_len = BN_num_bits(dh->p); 946. bn_wexpand(pub_key, dh->p->top); crypto/bn/bn_lib.c:298:1: start of procedure BN_new() 296. } 297. 298. > BIGNUM *BN_new(void) 299. { 300. BIGNUM *ret; crypto/bn/bn_lib.c:302:6: 300. BIGNUM *ret; 301. 302. > if ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL) 303. { 304. BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE); crypto/mem.c:291:1: start of procedure CRYPTO_malloc() 289. } 290. 291. > void *CRYPTO_malloc(int num, const char *file, int line) 292. { 293. void *ret = NULL; crypto/mem.c:293:2: 291. void *CRYPTO_malloc(int num, const char *file, int line) 292. { 293. > void *ret = NULL; 294. extern unsigned char cleanse_ctr; 295. crypto/mem.c:296:6: Taking false branch 294. extern unsigned char cleanse_ctr; 295. 296. if (num <= 0) return NULL; ^ 297. 298. allow_customize = 0; crypto/mem.c:298:2: 296. if (num <= 0) return NULL; 297. 298. > allow_customize = 0; 299. if (malloc_debug_func != NULL) 300. { crypto/mem.c:299:6: Taking true branch 297. 298. allow_customize = 0; 299. if (malloc_debug_func != NULL) ^ 300. { 301. allow_customize_debug = 0; crypto/mem.c:301:3: 299. if (malloc_debug_func != NULL) 300. { 301. > allow_customize_debug = 0; 302. malloc_debug_func(NULL, num, file, line, 0); 303. } crypto/mem.c:302:3: Skipping __function_pointer__(): unresolved function pointer 300. { 301. allow_customize_debug = 0; 302. malloc_debug_func(NULL, num, file, line, 0); ^ 303. } 304. ret = malloc_ex_func(num,file,line); crypto/mem.c:304:2: Skipping __function_pointer__(): unresolved function pointer 302. malloc_debug_func(NULL, num, file, line, 0); 303. } 304. ret = malloc_ex_func(num,file,line); ^ 305. #ifdef LEVITTE_DEBUG_MEM 306. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); crypto/mem.c:308:6: Taking true branch 306. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); 307. #endif 308. if (malloc_debug_func != NULL) ^ 309. malloc_debug_func(ret, num, file, line, 1); 310. crypto/mem.c:309:3: Skipping __function_pointer__(): unresolved function pointer 307. #endif 308. if (malloc_debug_func != NULL) 309. malloc_debug_func(ret, num, file, line, 1); ^ 310. 311. /* Create a dependency on the value of 'cleanse_ctr' so our memory crypto/mem.c:314:12: Taking false branch 312. * sanitisation function can't be optimised out. NB: We only do 313. * this for >2Kb so the overhead doesn't bother us. */ 314. if(ret && (num > 2048)) ^ 315. ((unsigned char *)ret)[0] = cleanse_ctr; 316. crypto/mem.c:317:2: 315. ((unsigned char *)ret)[0] = cleanse_ctr; 316. 317. > return ret; 318. } 319. crypto/mem.c:318:2: return from a call to CRYPTO_malloc 316. 317. return ret; 318. } ^ 319. 320. void *CRYPTO_realloc(void *str, int num, const char *file, int line) crypto/bn/bn_lib.c:302:6: Taking true branch 300. BIGNUM *ret; 301. 302. if ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL) ^ 303. { 304. BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:304:3: 302. if ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL) 303. { 304. > BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE); 305. return(NULL); 306. } crypto/err/err.c:666:1: start of procedure ERR_put_error() 664. /********************************************************/ 665. 666. > void ERR_put_error(int lib, int func, int reason, const char *file, 667. int line) 668. { crypto/err/err.c:690:2: Skipping ERR_get_state(): empty list of specs 688. } 689. #endif 690. es=ERR_get_state(); ^ 691. 692. es->top=(es->top+1)%ERR_NUM_ERRORS; crypto/err/err.c:692:2: 690. es=ERR_get_state(); 691. 692. > es->top=(es->top+1)%ERR_NUM_ERRORS; 693. if (es->top == es->bottom) 694. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; crypto/err/err.c:693:6: Taking false branch 691. 692. es->top=(es->top+1)%ERR_NUM_ERRORS; 693. if (es->top == es->bottom) ^ 694. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; 695. es->err_flags[es->top]=0; crypto/err/err.c:695:2: 693. if (es->top == es->bottom) 694. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; 695. > es->err_flags[es->top]=0; 696. es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 697. es->err_file[es->top]=file; crypto/err/err.c:696:2: 694. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; 695. es->err_flags[es->top]=0; 696. > es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 697. es->err_file[es->top]=file; 698. es->err_line[es->top]=line; crypto/err/err.c:697:2: 695. es->err_flags[es->top]=0; 696. es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 697. > es->err_file[es->top]=file; 698. es->err_line[es->top]=line; 699. err_clear_data(es,es->top); crypto/err/err.c:698:2: 696. es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 697. es->err_file[es->top]=file; 698. > es->err_line[es->top]=line; 699. err_clear_data(es,es->top); 700. } crypto/err/err.c:699:2: Taking true branch 697. es->err_file[es->top]=file; 698. es->err_line[es->top]=line; 699. err_clear_data(es,es->top); ^ 700. } 701. crypto/err/err.c:699:2: Taking false branch 697. es->err_file[es->top]=file; 698. es->err_line[es->top]=line; 699. err_clear_data(es,es->top); ^ 700. } 701. crypto/err/err.c:699:2: Loop condition is false. Leaving loop 697. es->err_file[es->top]=file; 698. es->err_line[es->top]=line; 699. err_clear_data(es,es->top); ^ 700. } 701. crypto/err/err.c:700:2: return from a call to ERR_put_error 698. es->err_line[es->top]=line; 699. err_clear_data(es,es->top); 700. } ^ 701. 702. void ERR_clear_error(void) crypto/bn/bn_lib.c:305:3: 303. { 304. BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE); 305. > return(NULL); 306. } 307. ret->flags=BN_FLG_MALLOCED; crypto/bn/bn_lib.c:314:2: return from a call to BN_new 312. bn_check_top(ret); 313. return(ret); 314. } ^ 315. 316. /* This is used both by bn_expand2() and bn_dup_expand() */ engines/e_ubsec.c:945:17: 943. { 944. pub_key = BN_new(); 945. > pub_key_len = BN_num_bits(dh->p); 946. bn_wexpand(pub_key, dh->p->top); 947. if(pub_key == NULL) goto err; crypto/bn/bn_lib.c:248:1: start of procedure BN_num_bits() 246. } 247. 248. > int BN_num_bits(const BIGNUM *a) 249. { 250. int i = a->top - 1; crypto/bn/bn_lib.c:250:2: 248. int BN_num_bits(const BIGNUM *a) 249. { 250. > int i = a->top - 1; 251. bn_check_top(a); 252. crypto/bn/bn_lib.c:253:6: Taking false branch 251. bn_check_top(a); 252. 253. if (BN_is_zero(a)) return 0; ^ 254. return ((i*BN_BITS2) + BN_num_bits_word(a->d[i])); 255. } crypto/bn/bn_lib.c:254:2: Skipping BN_num_bits_word(): empty list of specs 252. 253. if (BN_is_zero(a)) return 0; 254. return ((i*BN_BITS2) + BN_num_bits_word(a->d[i])); ^ 255. } 256. crypto/bn/bn_lib.c:255:2: return from a call to BN_num_bits 253. if (BN_is_zero(a)) return 0; 254. return ((i*BN_BITS2) + BN_num_bits_word(a->d[i])); 255. } ^ 256. 257. void BN_clear_free(BIGNUM *a) engines/e_ubsec.c:946:17: 944. pub_key = BN_new(); 945. pub_key_len = BN_num_bits(dh->p); 946. > bn_wexpand(pub_key, dh->p->top); 947. if(pub_key == NULL) goto err; 948. }
https://github.com/openssl/openssl/blob/0e3b6b70df7c2e02ec32818ceaec99b3ac8a85cc/engines/e_ubsec.c/#L946
d2a_code_trace_data_45914
static void contract(LHASH *lh) { LHASH_NODE **n,*n1,*np; np=lh->b[lh->p+lh->pmax-1]; lh->b[lh->p+lh->pmax-1]=NULL; if (lh->p == 0) { n=(LHASH_NODE **)OPENSSL_realloc(lh->b, (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax)); if (n == NULL) { lh->error++; return; } lh->num_contract_reallocs++; lh->num_alloc_nodes/=2; lh->pmax/=2; lh->p=lh->pmax-1; lh->b=n; } else lh->p--; lh->num_nodes--; lh->num_contracts++; n1=lh->b[(int)lh->p]; if (n1 == NULL) lh->b[(int)lh->p]=np; else { while (n1->next != NULL) n1=n1->next; n1->next=np; } } ssl/s3_clnt.c:1171: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `ssl3_send_alert`. Showing all 14 steps of the trace ssl/s3_clnt.c:889:4: Call 887. /* use same message size as in ssl3_get_certificate_request() 888. * as ServerKeyExchange message may be skipped */ 889. n=ssl3_get_message(s, ^ 890. SSL3_ST_CR_KEY_EXCH_A, 891. SSL3_ST_CR_KEY_EXCH_B, ssl/s3_both.c:337:1: Parameter `s->ctx->sessions->p` 335. * the body is read in state 'stn'. 336. */ 337. > long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok) 338. { 339. unsigned char *p; ssl/s3_clnt.c:1171:2: Call 1169. return(1); 1170. f_err: 1171. ssl3_send_alert(s,SSL3_AL_FATAL,al); ^ 1172. err: 1173. EVP_PKEY_free(pkey); ssl/s3_pkt.c:1155:1: Parameter `s->ctx->sessions->p` 1153. } 1154. 1155. > void ssl3_send_alert(SSL *s, int level, int desc) 1156. { 1157. /* Map tls/ssl alert value to correct one */ ssl/s3_pkt.c:1162:3: Call 1160. /* If a fatal one, remove from cache */ 1161. if ((level == 2) && (s->session != NULL)) 1162. SSL_CTX_remove_session(s->ctx,s->session); ^ 1163. 1164. s->s3->alert_dispatch=1; ssl/ssl_sess.c:468:1: Parameter `ctx->sessions->p` 466. } 467. 468. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 469. { 470. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:470:9: Call 468. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 469. { 470. return remove_session_lock(ctx, c, 1); ^ 471. } 472. ssl/ssl_sess.c:473:1: Parameter `ctx->sessions->p` 471. } 472. 473. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 474. { 475. SSL_SESSION *r; ssl/ssl_sess.c:481:20: Call 479. { 480. if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX); 481. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 482. if (r != NULL) 483. { crypto/lhash/lhash.c:217:1: Parameter `lh->pmax` 215. } 216. 217. > void *lh_delete(LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:243:3: Call 241. if ((lh->num_nodes > MIN_NODES) && 242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))) 243. contract(lh); ^ 244. 245. return((void *)ret); crypto/lhash/lhash.c:361:1: <LHS trace> 359. } 360. 361. > static void contract(LHASH *lh) 362. { 363. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:361:1: Parameter `lh->p` 359. } 360. 361. > static void contract(LHASH *lh) 362. { 363. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:365:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ssl3_send_alert` 363. LHASH_NODE **n,*n1,*np; 364. 365. np=lh->b[lh->p+lh->pmax-1]; ^ 366. lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */ 367. if (lh->p == 0)
https://github.com/openssl/openssl/blob/9e09eebf94c933686077a1b1b2d60248acb9ba67/crypto/lhash/lhash.c/#L365
d2a_code_trace_data_45915
EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) { ssl_clear_hash_ctx(hash); *hash = EVP_MD_CTX_new(); if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { EVP_MD_CTX_free(*hash); *hash = NULL; return NULL; } return *hash; } ssl/ssl_lib.c:3697: error: MEMORY_LEAK memory dynamically allocated to `*hash` by call to `EVP_MD_CTX_new()` at line 3694, column 13 is not reachable after line 3697, column 9. Showing all 50 steps of the trace ssl/ssl_lib.c:3691:1: start of procedure ssl_replace_hash() 3689. */ 3690. 3691. > EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) 3692. { 3693. ssl_clear_hash_ctx(hash); ssl/ssl_lib.c:3693:5: 3691. EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) 3692. { 3693. > ssl_clear_hash_ctx(hash); 3694. *hash = EVP_MD_CTX_new(); 3695. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ssl/ssl_lib.c:3703:1: start of procedure ssl_clear_hash_ctx() 3701. } 3702. 3703. > void ssl_clear_hash_ctx(EVP_MD_CTX **hash) 3704. { 3705. ssl/ssl_lib.c:3706:9: Taking true branch 3704. { 3705. 3706. if (*hash) ^ 3707. EVP_MD_CTX_free(*hash); 3708. *hash = NULL; ssl/ssl_lib.c:3707:9: 3705. 3706. if (*hash) 3707. > EVP_MD_CTX_free(*hash); 3708. *hash = NULL; 3709. } crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free() 47. } 48. 49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); ^ 52. OPENSSL_free(ctx); 53. } crypto/evp/digest.c:52:5: 50. { 51. EVP_MD_CTX_reset(ctx); 52. > OPENSSL_free(ctx); 53. } 54. crypto/mem.c:163:1: start of procedure CRYPTO_free() 161. } 162. 163. > void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:165:9: Taking false branch 163. void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 166. free_impl(str, file, line); 167. return; crypto/mem.c:179:5: 177. } 178. #else 179. > free(str); 180. #endif 181. } crypto/mem.c:181:1: return from a call to CRYPTO_free 179. free(str); 180. #endif 181. > } 182. 183. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:53:1: return from a call to EVP_MD_CTX_free 51. EVP_MD_CTX_reset(ctx); 52. OPENSSL_free(ctx); 53. > } 54. 55. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) ssl/ssl_lib.c:3708:5: 3706. if (*hash) 3707. EVP_MD_CTX_free(*hash); 3708. > *hash = NULL; 3709. } 3710. ssl/ssl_lib.c:3709:1: return from a call to ssl_clear_hash_ctx 3707. EVP_MD_CTX_free(*hash); 3708. *hash = NULL; 3709. > } 3710. 3711. /* Retrieve handshake hashes */ ssl/ssl_lib.c:3694:5: 3692. { 3693. ssl_clear_hash_ctx(hash); 3694. > *hash = EVP_MD_CTX_new(); 3695. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 3696. EVP_MD_CTX_free(*hash); crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new() 42. } 43. 44. > EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); crypto/evp/digest.c:46:5: 44. EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 47. } 48. crypto/mem.c:98:1: start of procedure CRYPTO_zalloc() 96. } 97. 98. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:100:5: 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. > void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) crypto/mem.c:71:1: start of procedure CRYPTO_malloc() 69. } 70. 71. > void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. void *ret = NULL; crypto/mem.c:73:5: 71. void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. > void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:75:9: Taking false branch 73. void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 76. return malloc_impl(num, file, line); 77. crypto/mem.c:78:9: Taking false branch 76. return malloc_impl(num, file, line); 77. 78. if (num <= 0) ^ 79. return NULL; 80. crypto/mem.c:81:5: 79. return NULL; 80. 81. > allow_customize = 0; 82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 83. if (call_malloc_debug) { crypto/mem.c:91:5: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:91:24: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:92:5: 90. #else 91. osslargused(file); osslargused(line); 92. > ret = malloc(num); 93. #endif 94. crypto/mem.c:95:5: 93. #endif 94. 95. > return ret; 96. } 97. crypto/mem.c:96:1: return from a call to CRYPTO_malloc 94. 95. return ret; 96. > } 97. 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:102:9: Taking true branch 100. void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) ^ 103. memset(ret, 0, num); 104. return ret; crypto/mem.c:103:9: 101. 102. if (ret != NULL) 103. > memset(ret, 0, num); 104. return ret; 105. } crypto/mem.c:104:5: 102. if (ret != NULL) 103. memset(ret, 0, num); 104. > return ret; 105. } 106. crypto/mem.c:105:1: return from a call to CRYPTO_zalloc 103. memset(ret, 0, num); 104. return ret; 105. > } 106. 107. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new 45. { 46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 47. > } 48. 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) ssl/ssl_lib.c:3695:9: Taking false branch 3693. ssl_clear_hash_ctx(hash); 3694. *hash = EVP_MD_CTX_new(); 3695. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 3696. EVP_MD_CTX_free(*hash); 3697. *hash = NULL; ssl/ssl_lib.c:3695:27: Taking true branch 3693. ssl_clear_hash_ctx(hash); 3694. *hash = EVP_MD_CTX_new(); 3695. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 3696. EVP_MD_CTX_free(*hash); 3697. *hash = NULL; ssl/ssl_lib.c:3695:33: Taking true branch 3693. ssl_clear_hash_ctx(hash); 3694. *hash = EVP_MD_CTX_new(); 3695. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 3696. EVP_MD_CTX_free(*hash); 3697. *hash = NULL; ssl/ssl_lib.c:3696:9: 3694. *hash = EVP_MD_CTX_new(); 3695. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 3696. > EVP_MD_CTX_free(*hash); 3697. *hash = NULL; 3698. return NULL; crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free() 47. } 48. 49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); ^ 52. OPENSSL_free(ctx); 53. } crypto/evp/digest.c:52:5: 50. { 51. EVP_MD_CTX_reset(ctx); 52. > OPENSSL_free(ctx); 53. } 54. crypto/mem.c:163:1: start of procedure CRYPTO_free() 161. } 162. 163. > void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:165:9: Taking true branch 163. void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 166. free_impl(str, file, line); 167. return; crypto/mem.c:165:30: Taking true branch 163. void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 166. free_impl(str, file, line); 167. return; crypto/mem.c:166:9: Skipping __function_pointer__(): unresolved function pointer 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { 166. free_impl(str, file, line); ^ 167. return; 168. } crypto/mem.c:167:9: 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { 166. free_impl(str, file, line); 167. > return; 168. } 169. crypto/mem.c:181:1: return from a call to CRYPTO_free 179. free(str); 180. #endif 181. > } 182. 183. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:53:1: return from a call to EVP_MD_CTX_free 51. EVP_MD_CTX_reset(ctx); 52. OPENSSL_free(ctx); 53. > } 54. 55. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) ssl/ssl_lib.c:3697:9: 3695. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 3696. EVP_MD_CTX_free(*hash); 3697. > *hash = NULL; 3698. return NULL; 3699. }
https://github.com/openssl/openssl/blob/3307000d9852acac98ebc1b82cacc9b14240d798/ssl/ssl_lib.c/#L3697
d2a_code_trace_data_45916
static int opt_vstats(const char *opt, const char *arg) { char filename[40]; time_t today2 = time(NULL); struct tm *today = localtime(&today2); snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, today->tm_sec); return opt_vstats_file(opt, filename); } avconv.c:4712: error: Null Dereference pointer `today` last assigned on line 4710 could be null and is dereferenced at line 4712, column 69. avconv.c:4706:1: start of procedure opt_vstats() 4704. } 4705. 4706. static int opt_vstats(const char *opt, const char *arg) ^ 4707. { 4708. char filename[40]; avconv.c:4709:5: 4707. { 4708. char filename[40]; 4709. time_t today2 = time(NULL); ^ 4710. struct tm *today = localtime(&today2); 4711. avconv.c:4710:5: 4708. char filename[40]; 4709. time_t today2 = time(NULL); 4710. struct tm *today = localtime(&today2); ^ 4711. 4712. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, avconv.c:4712:5: 4710. struct tm *today = localtime(&today2); 4711. 4712. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, ^ 4713. today->tm_sec); 4714. return opt_vstats_file(opt, filename);
https://github.com/libav/libav/blob/74853ed3f845212f4092e7b7e89dc2262926f4f5/avconv.c/#L4712
d2a_code_trace_data_45917
static int add_session(SSL *ssl, SSL_SESSION *session) { simple_ssl_session *sess; unsigned char *p; sess = OPENSSL_malloc(sizeof(simple_ssl_session)); sess->idlen = session->session_id_length; sess->derlen = i2d_SSL_SESSION(session, NULL); sess->id = BUF_memdup(session->session_id, sess->idlen); sess->der = OPENSSL_malloc(sess->derlen); p = sess->der; i2d_SSL_SESSION(session, &p); sess->next = first; first = sess; BIO_printf(bio_err, "New session added to external cache\n"); return 0; } apps/s_server.c:2843: error: NULL_DEREFERENCE pointer `sess` last assigned on line 2841 could be null and is dereferenced at line 2843, column 2. Showing all 16 steps of the trace apps/s_server.c:2836:1: start of procedure add_session() 2834. static simple_ssl_session *first = NULL; 2835. 2836. > static int add_session(SSL *ssl, SSL_SESSION *session) 2837. { 2838. simple_ssl_session *sess; apps/s_server.c:2841:2: 2839. unsigned char *p; 2840. 2841. > sess = OPENSSL_malloc(sizeof(simple_ssl_session)); 2842. 2843. sess->idlen = session->session_id_length; crypto/mem.c:294:1: start of procedure CRYPTO_malloc() 292. } 293. 294. > void *CRYPTO_malloc(int num, const char *file, int line) 295. { 296. void *ret = NULL; crypto/mem.c:296:2: 294. void *CRYPTO_malloc(int num, const char *file, int line) 295. { 296. > void *ret = NULL; 297. 298. if (num <= 0) return NULL; crypto/mem.c:298:6: Taking false branch 296. void *ret = NULL; 297. 298. if (num <= 0) return NULL; ^ 299. 300. allow_customize = 0; crypto/mem.c:300:2: 298. if (num <= 0) return NULL; 299. 300. > allow_customize = 0; 301. if (malloc_debug_func != NULL) 302. { crypto/mem.c:301:6: Taking true branch 299. 300. allow_customize = 0; 301. if (malloc_debug_func != NULL) ^ 302. { 303. allow_customize_debug = 0; crypto/mem.c:303:3: 301. if (malloc_debug_func != NULL) 302. { 303. > allow_customize_debug = 0; 304. malloc_debug_func(NULL, num, file, line, 0); 305. } crypto/mem.c:304:3: Skipping __function_pointer__(): unresolved function pointer 302. { 303. allow_customize_debug = 0; 304. malloc_debug_func(NULL, num, file, line, 0); ^ 305. } 306. ret = malloc_ex_func(num,file,line); crypto/mem.c:306:2: Skipping __function_pointer__(): unresolved function pointer 304. malloc_debug_func(NULL, num, file, line, 0); 305. } 306. ret = malloc_ex_func(num,file,line); ^ 307. #ifdef LEVITTE_DEBUG_MEM 308. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); crypto/mem.c:310:6: Taking true branch 308. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); 309. #endif 310. if (malloc_debug_func != NULL) ^ 311. malloc_debug_func(ret, num, file, line, 1); 312. crypto/mem.c:311:3: Skipping __function_pointer__(): unresolved function pointer 309. #endif 310. if (malloc_debug_func != NULL) 311. malloc_debug_func(ret, num, file, line, 1); ^ 312. 313. #ifndef OPENSSL_CPUID_OBJ crypto/mem.c:317:12: Taking false branch 315. * sanitisation function can't be optimised out. NB: We only do 316. * this for >2Kb so the overhead doesn't bother us. */ 317. if(ret && (num > 2048)) ^ 318. { extern unsigned char cleanse_ctr; 319. ((unsigned char *)ret)[0] = cleanse_ctr; crypto/mem.c:323:2: 321. #endif 322. 323. > return ret; 324. } 325. char *CRYPTO_strdup(const char *str, const char *file, int line) crypto/mem.c:324:2: return from a call to CRYPTO_malloc 322. 323. return ret; 324. } ^ 325. char *CRYPTO_strdup(const char *str, const char *file, int line) 326. { apps/s_server.c:2843:2: 2841. sess = OPENSSL_malloc(sizeof(simple_ssl_session)); 2842. 2843. > sess->idlen = session->session_id_length; 2844. sess->derlen = i2d_SSL_SESSION(session, NULL); 2845.
https://github.com/openssl/openssl/blob/dd4a0af3701b1669661d62420253ec1e40076e61/apps/s_server.c/#L2843
d2a_code_trace_data_45918
char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) { X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_IA5STRING) { ascii2ebcdic(ebcdic_buf, q, (num > (int)sizeof(ebcdic_buf)) ? (int)sizeof(ebcdic_buf) : num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); BUF_MEM_free(b); return (NULL); } crypto/x509/t_crl.c:99: error: BUFFER_OVERRUN_L3 Offset: [-1, 199] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace crypto/x509/t_crl.c:99:9: Call 97. X509_CRL_get0_signature(&sig, &sig_alg, x); 98. X509_signature_print(out, sig_alg, NULL); 99. p = X509_NAME_oneline(X509_CRL_get_issuer(x), NULL, 0); ^ 100. BIO_printf(out, "%8sIssuer: %s\n", "", p); 101. OPENSSL_free(p); crypto/x509/x509_obj.c:66:1: <Offset trace> 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: Parameter `len` 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: <Length trace> 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: Parameter `*buf` 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:98:9: Array access: Offset: [-1, 199] Size: [1, 2147483644] by call to `X509_NAME_oneline` 96. } 97. strncpy(buf, "NO X509_NAME", len); 98. buf[len - 1] = '\0'; ^ 99. return buf; 100. }
https://github.com/openssl/openssl/blob/b33d1141b6dcce947708b984c5e9e91dad3d675d/crypto/x509/x509_obj.c/#L98
d2a_code_trace_data_45919
char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) { X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; if (num > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_IA5STRING) { ascii2ebcdic(ebcdic_buf, q, (num > (int)sizeof(ebcdic_buf)) ? (int)sizeof(ebcdic_buf) : num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (l > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); end: BUF_MEM_free(b); return (NULL); } apps/apps.c:1239: error: BUFFER_OVERRUN_L3 Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace apps/apps.c:1239:15: Call 1237. } 1238. if (lflags == XN_FLAG_COMPAT) { 1239. buf = X509_NAME_oneline(nm, 0, 0); ^ 1240. BIO_puts(out, buf); 1241. BIO_puts(out, "\n"); crypto/x509/x509_obj.c:73:1: <Offset trace> 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: Parameter `len` 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: <Length trace> 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: Parameter `*buf` 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:104:9: Array access: Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline` 102. OPENSSL_free(b); 103. } 104. strncpy(buf, "NO X509_NAME", len); ^ 105. buf[len - 1] = '\0'; 106. return buf;
https://github.com/openssl/openssl/blob/24c2cd3967ed23acc0bd31a3781c4525e2e42a2c/crypto/x509/x509_obj.c/#L104
d2a_code_trace_data_45920
int BN_hex2bn(BIGNUM **bn, const char *a) { BIGNUM *ret = NULL; BN_ULONG l = 0; int neg = 0, h, m, i, j, k, c; int num; if (a == NULL || *a == '\0') return 0; if (*a == '-') { neg = 1; a++; } for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) continue; if (i == 0 || i > INT_MAX / 4) goto err; num = i + neg; if (bn == NULL) return num; if (*bn == NULL) { if ((ret = BN_new()) == NULL) return 0; } else { ret = *bn; BN_zero(ret); } if (bn_expand(ret, i * 4) == NULL) goto err; j = i; m = 0; h = 0; while (j > 0) { m = (BN_BYTES * 2 <= j) ? BN_BYTES * 2 : j; l = 0; for (;;) { c = a[j - m]; k = OPENSSL_hexchar2int(c); if (k < 0) k = 0; l = (l << 4) | k; if (--m <= 0) { ret->d[h++] = l; break; } } j -= BN_BYTES * 2; } ret->top = h; bn_correct_top(ret); *bn = ret; bn_check_top(ret); if (ret->top != 0) ret->neg = neg; return num; err: if (*bn == NULL) BN_free(ret); return 0; } test/params_test.c:103: error: BUFFER_OVERRUN_L2 Offset: [0, 536870912] (⇐ [0, 1] + [0, 536870911]) Size: 125 by call to `BN_hex2bn`. Showing all 6 steps of the trace test/params_test.c:103:10: Call 101. obj->p1 = p1_init; 102. obj->p2 = p2_init; 103. if (!TEST_true(BN_hex2bn(&obj->p3, p3_init))) ^ 104. goto fail; 105. if (!TEST_ptr(obj->p4 = OPENSSL_strdup(p4_init))) crypto/bn/bn_print.c:141:10: <Offset trace> 139. } 140. 141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) ^ 142. continue; 143. crypto/bn/bn_print.c:141:10: Assignment 139. } 140. 141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) ^ 142. continue; 143. crypto/bn/bn_print.c:126:1: <Length trace> 124. } 125. 126. > int BN_hex2bn(BIGNUM **bn, const char *a) 127. { 128. BIGNUM *ret = NULL; crypto/bn/bn_print.c:126:1: Parameter `*a` 124. } 125. 126. > int BN_hex2bn(BIGNUM **bn, const char *a) 127. { 128. BIGNUM *ret = NULL; crypto/bn/bn_print.c:141:37: Array access: Offset: [0, 536870912] (⇐ [0, 1] + [0, 536870911]) Size: 125 by call to `BN_hex2bn` 139. } 140. 141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) ^ 142. continue; 143.
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_print.c/#L141
d2a_code_trace_data_45921
static int epzs_motion_search4(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d, dmin; int map_generation; const int penalty_factor= c->penalty_factor; const int size=1; const int h=8; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y *ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON int flags= c->flags; LOAD_COMMON2 cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; map_generation= update_map_generation(c); dmin = 1000000; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) }else{ CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift) CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) } if(dmin>64*4){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1177: error: Uninitialized Value The value read from ymin was never initialized. libavcodec/motion_est_template.c:1177:13: 1175. (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) 1176. if(s->mb_y+1<s->end_mb_y) //FIXME replace at least with last_slice_line 1177. CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, ^ 1178. (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) 1179. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1177
d2a_code_trace_data_45922
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) { unsigned long hash; OPENSSL_LH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } apps/s_server.c:2063: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_clear`. Showing all 16 steps of the trace apps/s_server.c:2048:15: Call 2046. 2047. if (con == NULL) { 2048. con = SSL_new(ctx); ^ 2049. 2050. if (s_tlsextdebug) { ssl/ssl_lib.c:518:1: Parameter `ctx->sessions->num_items` 516. } 517. 518. > SSL *SSL_new(SSL_CTX *ctx) 519. { 520. SSL *s; apps/s_server.c:2063:10: Call 2061. } 2062. } 2063. if (!SSL_clear(con)) { ^ 2064. BIO_printf(bio_err, "Error clearing SSL connection\n"); 2065. ret = -1; ssl/ssl_lib.c:440:1: Parameter `s->initial_ctx->sessions->num_items` 438. } 439. 440. > int SSL_clear(SSL *s) 441. { 442. if (s->method == NULL) { ssl/ssl_lib.c:447:9: Call 445. } 446. 447. if (ssl_clear_bad_session(s)) { ^ 448. SSL_SESSION_free(s->session); 449. s->session = NULL; ssl/ssl_sess.c:992:1: Parameter `s->initial_ctx->sessions->num_items` 990. } 991. 992. > int ssl_clear_bad_session(SSL *s) 993. { 994. if ((s->session != NULL) && ssl/ssl_sess.c:997:9: Call 995. !(s->shutdown & SSL_SENT_SHUTDOWN) && 996. !(SSL_in_init(s) || SSL_in_before(s))) { 997. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 998. return (1); 999. } else ssl/ssl_sess.c:691:1: Parameter `ctx->sessions->num_items` 689. } 690. 691. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 692. { 693. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:693:12: Call 691. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 692. { 693. return remove_session_lock(ctx, c, 1); ^ 694. } 695. ssl/ssl_sess.c:696:1: Parameter `ctx->sessions->num_items` 694. } 695. 696. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 697. { 698. SSL_SESSION *r; ssl/ssl_sess.c:706:17: Call 704. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 705. ret = 1; 706. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 707. SSL_SESSION_list_remove(ctx, c); 708. } ssl/ssl_locl.h:581:1: Parameter `lh->num_items` 579. }; 580. 581. > DEFINE_LHASH_OF(SSL_SESSION); 582. /* Needed in ssl_cert.c */ 583. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:581:1: Call 579. }; 580. 581. > DEFINE_LHASH_OF(SSL_SESSION); 582. /* Needed in ssl_cert.c */ 583. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:103:1: <LHS trace> 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:103:1: Parameter `lh->num_items` 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:123:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_clear` 121. } 122. 123. lh->num_items--; ^ 124. if ((lh->num_nodes > MIN_NODES) && 125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_45923
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/ec_internal_test.c:90: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `group_field_tests`. Showing all 13 steps of the trace test/ec_internal_test.c:81:5: Call 79. return 0; 80. 81. BN_CTX_start(ctx); ^ 82. p = BN_CTX_get(ctx); 83. a = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); test/ec_internal_test.c:90:13: Call 88. || !TEST_true(BN_bin2bn(params + 2 * len, len, b)) 89. || !TEST_true(EC_GROUP_set_curve(group, p, a, b, ctx)) 90. || !group_field_tests(group, ctx)) ^ 91. goto err; 92. ret = 1; test/ec_internal_test.c:28:5: Call 26. return 1; 27. 28. BN_CTX_start(ctx); ^ 29. a = BN_CTX_get(ctx); 30. b = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); test/ec_internal_test.c:65:5: Call 63. ret = 1; 64. err: 65. BN_CTX_end(ctx); ^ 66. return ret; 67. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `group_field_tests` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_45924
int MAIN(int argc, char **argv) { unsigned char *buf_malloc = NULL, *buf2_malloc = NULL; unsigned char *buf = NULL, *buf2 = NULL; int mret = 1; long count = 0, save_count = 0; int i, j, k; #if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA) long rsa_count; #endif #ifndef OPENSSL_NO_RSA unsigned rsa_num; #endif unsigned char md[EVP_MAX_MD_SIZE]; #ifndef OPENSSL_NO_MD2 unsigned char md2[MD2_DIGEST_LENGTH]; #endif #ifndef OPENSSL_NO_MDC2 unsigned char mdc2[MDC2_DIGEST_LENGTH]; #endif #ifndef OPENSSL_NO_MD4 unsigned char md4[MD4_DIGEST_LENGTH]; #endif #ifndef OPENSSL_NO_MD5 unsigned char md5[MD5_DIGEST_LENGTH]; unsigned char hmac[MD5_DIGEST_LENGTH]; #endif unsigned char sha[SHA_DIGEST_LENGTH]; unsigned char sha256[SHA256_DIGEST_LENGTH]; unsigned char sha512[SHA512_DIGEST_LENGTH]; #ifndef OPENSSL_NO_WHIRLPOOL unsigned char whirlpool[WHIRLPOOL_DIGEST_LENGTH]; #endif #ifndef OPENSSL_NO_RMD160 unsigned char rmd160[RIPEMD160_DIGEST_LENGTH]; #endif #ifndef OPENSSL_NO_RC4 RC4_KEY rc4_ks; #endif #ifndef OPENSSL_NO_RC5 RC5_32_KEY rc5_ks; #endif #ifndef OPENSSL_NO_RC2 RC2_KEY rc2_ks; #endif #ifndef OPENSSL_NO_IDEA IDEA_KEY_SCHEDULE idea_ks; #endif #ifndef OPENSSL_NO_SEED SEED_KEY_SCHEDULE seed_ks; #endif #ifndef OPENSSL_NO_BF BF_KEY bf_ks; #endif #ifndef OPENSSL_NO_CAST CAST_KEY cast_ks; #endif static const unsigned char key16[16] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12 }; #ifndef OPENSSL_NO_AES static const unsigned char key24[24] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34 }; static const unsigned char key32[32] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56 }; #endif #ifndef OPENSSL_NO_CAMELLIA static const unsigned char ckey24[24] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34 }; static const unsigned char ckey32[32] = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34, 0x56 }; #endif #ifndef OPENSSL_NO_AES # define MAX_BLOCK_SIZE 128 #else # define MAX_BLOCK_SIZE 64 #endif unsigned char DES_iv[8]; unsigned char iv[2 * MAX_BLOCK_SIZE / 8]; #ifndef OPENSSL_NO_DES static DES_cblock key = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 }; static DES_cblock key2 = { 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12 }; static DES_cblock key3 = { 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x12, 0x34 }; DES_key_schedule sch; DES_key_schedule sch2; DES_key_schedule sch3; #endif #ifndef OPENSSL_NO_AES AES_KEY aes_ks1, aes_ks2, aes_ks3; #endif #ifndef OPENSSL_NO_CAMELLIA CAMELLIA_KEY camellia_ks1, camellia_ks2, camellia_ks3; #endif #define D_MD2 0 #define D_MDC2 1 #define D_MD4 2 #define D_MD5 3 #define D_HMAC 4 #define D_SHA1 5 #define D_RMD160 6 #define D_RC4 7 #define D_CBC_DES 8 #define D_EDE3_DES 9 #define D_CBC_IDEA 10 #define D_CBC_SEED 11 #define D_CBC_RC2 12 #define D_CBC_RC5 13 #define D_CBC_BF 14 #define D_CBC_CAST 15 #define D_CBC_128_AES 16 #define D_CBC_192_AES 17 #define D_CBC_256_AES 18 #define D_CBC_128_CML 19 #define D_CBC_192_CML 20 #define D_CBC_256_CML 21 #define D_EVP 22 #define D_SHA256 23 #define D_SHA512 24 #define D_WHIRLPOOL 25 #define D_IGE_128_AES 26 #define D_IGE_192_AES 27 #define D_IGE_256_AES 28 #define D_GHASH 29 double d = 0.0; long c[ALGOR_NUM][SIZE_NUM]; #ifndef OPENSSL_SYS_WIN32 #endif #define R_DSA_512 0 #define R_DSA_1024 1 #define R_DSA_2048 2 #define R_RSA_512 0 #define R_RSA_1024 1 #define R_RSA_2048 2 #define R_RSA_3072 3 #define R_RSA_4096 4 #define R_RSA_7680 5 #define R_RSA_15360 6 #define R_EC_P160 0 #define R_EC_P192 1 #define R_EC_P224 2 #define R_EC_P256 3 #define R_EC_P384 4 #define R_EC_P521 5 #define R_EC_K163 6 #define R_EC_K233 7 #define R_EC_K283 8 #define R_EC_K409 9 #define R_EC_K571 10 #define R_EC_B163 11 #define R_EC_B233 12 #define R_EC_B283 13 #define R_EC_B409 14 #define R_EC_B571 15 #ifndef OPENSSL_NO_RSA RSA *rsa_key[RSA_NUM]; long rsa_c[RSA_NUM][2]; static unsigned int rsa_bits[RSA_NUM] = { 512, 1024, 2048, 3072, 4096, 7680, 15360 }; static unsigned char *rsa_data[RSA_NUM] = { test512, test1024, test2048, test3072, test4096, test7680, test15360 }; static int rsa_data_length[RSA_NUM] = { sizeof(test512), sizeof(test1024), sizeof(test2048), sizeof(test3072), sizeof(test4096), sizeof(test7680), sizeof(test15360) }; #endif #ifndef OPENSSL_NO_DSA DSA *dsa_key[DSA_NUM]; long dsa_c[DSA_NUM][2]; static unsigned int dsa_bits[DSA_NUM] = { 512, 1024, 2048 }; #endif #ifndef OPENSSL_NO_EC static unsigned int test_curves[EC_NUM] = { NID_secp160r1, NID_X9_62_prime192v1, NID_secp224r1, NID_X9_62_prime256v1, NID_secp384r1, NID_secp521r1, NID_sect163k1, NID_sect233k1, NID_sect283k1, NID_sect409k1, NID_sect571k1, NID_sect163r2, NID_sect233r1, NID_sect283r1, NID_sect409r1, NID_sect571r1 }; static const char *test_curves_names[EC_NUM] = { "secp160r1", "nistp192", "nistp224", "nistp256", "nistp384", "nistp521", "nistk163", "nistk233", "nistk283", "nistk409", "nistk571", "nistb163", "nistb233", "nistb283", "nistb409", "nistb571" }; static int test_curves_bits[EC_NUM] = { 160, 192, 224, 256, 384, 521, 163, 233, 283, 409, 571, 163, 233, 283, 409, 571 }; #endif #ifndef OPENSSL_NO_EC unsigned char ecdsasig[256]; unsigned int ecdsasiglen; EC_KEY *ecdsa[EC_NUM]; long ecdsa_c[EC_NUM][2]; EC_KEY *ecdh_a[EC_NUM], *ecdh_b[EC_NUM]; unsigned char secret_a[MAX_ECDH_SIZE], secret_b[MAX_ECDH_SIZE]; int secret_size_a, secret_size_b; int ecdh_checks = 0; int secret_idx = 0; long ecdh_c[EC_NUM][2]; int ecdsa_doit[EC_NUM]; int ecdh_doit[EC_NUM]; #endif int rsa_doit[RSA_NUM]; int dsa_doit[DSA_NUM]; int doit[ALGOR_NUM]; int pr_header = 0; const EVP_CIPHER *evp_cipher = NULL; const EVP_MD *evp_md = NULL; int decrypt = 0; #ifndef NO_FORK int multi = 0; #endif int multiblock = 0; int misalign = MAX_MISALIGNMENT + 1; #ifndef TIMES usertime = -1; #endif apps_startup(); memset(results, 0, sizeof(results)); #ifndef OPENSSL_NO_DSA memset(dsa_key, 0, sizeof(dsa_key)); #endif #ifndef OPENSSL_NO_EC for (i = 0; i < EC_NUM; i++) ecdsa[i] = NULL; for (i = 0; i < EC_NUM; i++) { ecdh_a[i] = NULL; ecdh_b[i] = NULL; } #endif if (bio_err == NULL) if ((bio_err = BIO_new(BIO_s_file())) != NULL) BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT); if (!load_config(bio_err, NULL)) goto end; #ifndef OPENSSL_NO_RSA memset(rsa_key, 0, sizeof(rsa_key)); for (i = 0; i < RSA_NUM; i++) rsa_key[i] = NULL; #endif if ((buf_malloc = (unsigned char *)OPENSSL_malloc(BUFSIZE + misalign)) == NULL) { BIO_printf(bio_err, "out of memory\n"); goto end; } if ((buf2_malloc = (unsigned char *)OPENSSL_malloc(BUFSIZE + misalign)) == NULL) { BIO_printf(bio_err, "out of memory\n"); goto end; } misalign = 0; buf = buf_malloc; buf2 = buf2_malloc; memset(c, 0, sizeof(c)); memset(DES_iv, 0, sizeof(DES_iv)); memset(iv, 0, sizeof(iv)); for (i = 0; i < ALGOR_NUM; i++) doit[i] = 0; for (i = 0; i < RSA_NUM; i++) rsa_doit[i] = 0; for (i = 0; i < DSA_NUM; i++) dsa_doit[i] = 0; #ifndef OPENSSL_NO_EC for (i = 0; i < EC_NUM; i++) ecdsa_doit[i] = 0; for (i = 0; i < EC_NUM; i++) ecdh_doit[i] = 0; #endif j = 0; argc--; argv++; while (argc) { if ((argc > 0) && (strcmp(*argv, "-elapsed") == 0)) { usertime = 0; j--; } else if ((argc > 0) && (strcmp(*argv, "-evp") == 0)) { argc--; argv++; if (argc == 0) { BIO_printf(bio_err, "no EVP given\n"); goto end; } evp_cipher = EVP_get_cipherbyname(*argv); if (!evp_cipher) { evp_md = EVP_get_digestbyname(*argv); } if (!evp_cipher && !evp_md) { BIO_printf(bio_err, "%s is an unknown cipher or digest\n", *argv); goto end; } doit[D_EVP] = 1; } else if (argc > 0 && !strcmp(*argv, "-decrypt")) { decrypt = 1; j--; } #ifndef OPENSSL_NO_ENGINE else if ((argc > 0) && (strcmp(*argv, "-engine") == 0)) { argc--; argv++; if (argc == 0) { BIO_printf(bio_err, "no engine given\n"); goto end; } setup_engine(bio_err, *argv, 0); j--; } #endif #ifndef NO_FORK else if ((argc > 0) && (strcmp(*argv, "-multi") == 0)) { argc--; argv++; if (argc == 0) { BIO_printf(bio_err, "no multi count given\n"); goto end; } multi = atoi(argv[0]); if (multi <= 0) { BIO_printf(bio_err, "bad multi count\n"); goto end; } j--; } #endif else if (argc > 0 && !strcmp(*argv, "-mr")) { mr = 1; j--; } else if (argc > 0 && !strcmp(*argv, "-mb")) { multiblock = 1; j--; } else if (argc > 0 && !strcmp(*argv, "-misalign")) { argc--; argv++; if (argc == 0) { BIO_printf(bio_err, "no misalignment given\n"); goto end; } misalign = atoi(argv[0]); if (misalign < 0 || misalign > MAX_MISALIGNMENT) { BIO_printf(bio_err, "misalignment is outsize permitted range 0-%d\n", MAX_MISALIGNMENT); goto end; } buf = buf_malloc + misalign; buf2 = buf2_malloc + misalign; j--; } else #ifndef OPENSSL_NO_MD2 if (strcmp(*argv, "md2") == 0) doit[D_MD2] = 1; else #endif #ifndef OPENSSL_NO_MDC2 if (strcmp(*argv, "mdc2") == 0) doit[D_MDC2] = 1; else #endif #ifndef OPENSSL_NO_MD4 if (strcmp(*argv, "md4") == 0) doit[D_MD4] = 1; else #endif #ifndef OPENSSL_NO_MD5 if (strcmp(*argv, "md5") == 0) doit[D_MD5] = 1; else #endif #ifndef OPENSSL_NO_MD5 if (strcmp(*argv, "hmac") == 0) doit[D_HMAC] = 1; else #endif if (strcmp(*argv, "sha1") == 0) doit[D_SHA1] = 1; else if (strcmp(*argv, "sha") == 0) doit[D_SHA1] = 1, doit[D_SHA256] = 1, doit[D_SHA512] = 1; else if (strcmp(*argv, "sha256") == 0) doit[D_SHA256] = 1; else if (strcmp(*argv, "sha512") == 0) doit[D_SHA512] = 1; else #ifndef OPENSSL_NO_WHIRLPOOL if (strcmp(*argv, "whirlpool") == 0) doit[D_WHIRLPOOL] = 1; else #endif #ifndef OPENSSL_NO_RMD160 if (strcmp(*argv, "ripemd") == 0) doit[D_RMD160] = 1; else if (strcmp(*argv, "rmd160") == 0) doit[D_RMD160] = 1; else if (strcmp(*argv, "ripemd160") == 0) doit[D_RMD160] = 1; else #endif #ifndef OPENSSL_NO_RC4 if (strcmp(*argv, "rc4") == 0) doit[D_RC4] = 1; else #endif #ifndef OPENSSL_NO_DES if (strcmp(*argv, "des-cbc") == 0) doit[D_CBC_DES] = 1; else if (strcmp(*argv, "des-ede3") == 0) doit[D_EDE3_DES] = 1; else #endif #ifndef OPENSSL_NO_AES if (strcmp(*argv, "aes-128-cbc") == 0) doit[D_CBC_128_AES] = 1; else if (strcmp(*argv, "aes-192-cbc") == 0) doit[D_CBC_192_AES] = 1; else if (strcmp(*argv, "aes-256-cbc") == 0) doit[D_CBC_256_AES] = 1; else if (strcmp(*argv, "aes-128-ige") == 0) doit[D_IGE_128_AES] = 1; else if (strcmp(*argv, "aes-192-ige") == 0) doit[D_IGE_192_AES] = 1; else if (strcmp(*argv, "aes-256-ige") == 0) doit[D_IGE_256_AES] = 1; else #endif #ifndef OPENSSL_NO_CAMELLIA if (strcmp(*argv, "camellia-128-cbc") == 0) doit[D_CBC_128_CML] = 1; else if (strcmp(*argv, "camellia-192-cbc") == 0) doit[D_CBC_192_CML] = 1; else if (strcmp(*argv, "camellia-256-cbc") == 0) doit[D_CBC_256_CML] = 1; else #endif #ifndef OPENSSL_NO_RSA # ifndef RSA_NULL if (strcmp(*argv, "openssl") == 0) { RSA_set_default_method(RSA_PKCS1_SSLeay()); j--; } else # endif #endif if (strcmp(*argv, "dsa512") == 0) dsa_doit[R_DSA_512] = 2; else if (strcmp(*argv, "dsa1024") == 0) dsa_doit[R_DSA_1024] = 2; else if (strcmp(*argv, "dsa2048") == 0) dsa_doit[R_DSA_2048] = 2; else if (strcmp(*argv, "rsa512") == 0) rsa_doit[R_RSA_512] = 2; else if (strcmp(*argv, "rsa1024") == 0) rsa_doit[R_RSA_1024] = 2; else if (strcmp(*argv, "rsa2048") == 0) rsa_doit[R_RSA_2048] = 2; else if (strcmp(*argv, "rsa3072") == 0) rsa_doit[R_RSA_3072] = 2; else if (strcmp(*argv, "rsa4096") == 0) rsa_doit[R_RSA_4096] = 2; else if (strcmp(*argv, "rsa7680") == 0) rsa_doit[R_RSA_7680] = 2; else if (strcmp(*argv, "rsa15360") == 0) rsa_doit[R_RSA_15360] = 2; else #ifndef OPENSSL_NO_RC2 if (strcmp(*argv, "rc2-cbc") == 0) doit[D_CBC_RC2] = 1; else if (strcmp(*argv, "rc2") == 0) doit[D_CBC_RC2] = 1; else #endif #ifndef OPENSSL_NO_RC5 if (strcmp(*argv, "rc5-cbc") == 0) doit[D_CBC_RC5] = 1; else if (strcmp(*argv, "rc5") == 0) doit[D_CBC_RC5] = 1; else #endif #ifndef OPENSSL_NO_IDEA if (strcmp(*argv, "idea-cbc") == 0) doit[D_CBC_IDEA] = 1; else if (strcmp(*argv, "idea") == 0) doit[D_CBC_IDEA] = 1; else #endif #ifndef OPENSSL_NO_SEED if (strcmp(*argv, "seed-cbc") == 0) doit[D_CBC_SEED] = 1; else if (strcmp(*argv, "seed") == 0) doit[D_CBC_SEED] = 1; else #endif #ifndef OPENSSL_NO_BF if (strcmp(*argv, "bf-cbc") == 0) doit[D_CBC_BF] = 1; else if (strcmp(*argv, "blowfish") == 0) doit[D_CBC_BF] = 1; else if (strcmp(*argv, "bf") == 0) doit[D_CBC_BF] = 1; else #endif #ifndef OPENSSL_NO_CAST if (strcmp(*argv, "cast-cbc") == 0) doit[D_CBC_CAST] = 1; else if (strcmp(*argv, "cast") == 0) doit[D_CBC_CAST] = 1; else if (strcmp(*argv, "cast5") == 0) doit[D_CBC_CAST] = 1; else #endif #ifndef OPENSSL_NO_DES if (strcmp(*argv, "des") == 0) { doit[D_CBC_DES] = 1; doit[D_EDE3_DES] = 1; } else #endif #ifndef OPENSSL_NO_AES if (strcmp(*argv, "aes") == 0) { doit[D_CBC_128_AES] = 1; doit[D_CBC_192_AES] = 1; doit[D_CBC_256_AES] = 1; } else if (strcmp(*argv, "ghash") == 0) { doit[D_GHASH] = 1; } else #endif #ifndef OPENSSL_NO_CAMELLIA if (strcmp(*argv, "camellia") == 0) { doit[D_CBC_128_CML] = 1; doit[D_CBC_192_CML] = 1; doit[D_CBC_256_CML] = 1; } else #endif #ifndef OPENSSL_NO_RSA if (strcmp(*argv, "rsa") == 0) { rsa_doit[R_RSA_512] = 1; rsa_doit[R_RSA_1024] = 1; rsa_doit[R_RSA_2048] = 1; rsa_doit[R_RSA_3072] = 1; rsa_doit[R_RSA_4096] = 1; rsa_doit[R_RSA_7680] = 1; rsa_doit[R_RSA_15360] = 1; } else #endif #ifndef OPENSSL_NO_DSA if (strcmp(*argv, "dsa") == 0) { dsa_doit[R_DSA_512] = 1; dsa_doit[R_DSA_1024] = 1; dsa_doit[R_DSA_2048] = 1; } else #endif #ifndef OPENSSL_NO_EC if (strcmp(*argv, "ecdsap160") == 0) ecdsa_doit[R_EC_P160] = 2; else if (strcmp(*argv, "ecdsap192") == 0) ecdsa_doit[R_EC_P192] = 2; else if (strcmp(*argv, "ecdsap224") == 0) ecdsa_doit[R_EC_P224] = 2; else if (strcmp(*argv, "ecdsap256") == 0) ecdsa_doit[R_EC_P256] = 2; else if (strcmp(*argv, "ecdsap384") == 0) ecdsa_doit[R_EC_P384] = 2; else if (strcmp(*argv, "ecdsap521") == 0) ecdsa_doit[R_EC_P521] = 2; else if (strcmp(*argv, "ecdsak163") == 0) ecdsa_doit[R_EC_K163] = 2; else if (strcmp(*argv, "ecdsak233") == 0) ecdsa_doit[R_EC_K233] = 2; else if (strcmp(*argv, "ecdsak283") == 0) ecdsa_doit[R_EC_K283] = 2; else if (strcmp(*argv, "ecdsak409") == 0) ecdsa_doit[R_EC_K409] = 2; else if (strcmp(*argv, "ecdsak571") == 0) ecdsa_doit[R_EC_K571] = 2; else if (strcmp(*argv, "ecdsab163") == 0) ecdsa_doit[R_EC_B163] = 2; else if (strcmp(*argv, "ecdsab233") == 0) ecdsa_doit[R_EC_B233] = 2; else if (strcmp(*argv, "ecdsab283") == 0) ecdsa_doit[R_EC_B283] = 2; else if (strcmp(*argv, "ecdsab409") == 0) ecdsa_doit[R_EC_B409] = 2; else if (strcmp(*argv, "ecdsab571") == 0) ecdsa_doit[R_EC_B571] = 2; else if (strcmp(*argv, "ecdsa") == 0) { for (i = 0; i < EC_NUM; i++) ecdsa_doit[i] = 1; } else if (strcmp(*argv, "ecdhp160") == 0) ecdh_doit[R_EC_P160] = 2; else if (strcmp(*argv, "ecdhp192") == 0) ecdh_doit[R_EC_P192] = 2; else if (strcmp(*argv, "ecdhp224") == 0) ecdh_doit[R_EC_P224] = 2; else if (strcmp(*argv, "ecdhp256") == 0) ecdh_doit[R_EC_P256] = 2; else if (strcmp(*argv, "ecdhp384") == 0) ecdh_doit[R_EC_P384] = 2; else if (strcmp(*argv, "ecdhp521") == 0) ecdh_doit[R_EC_P521] = 2; else if (strcmp(*argv, "ecdhk163") == 0) ecdh_doit[R_EC_K163] = 2; else if (strcmp(*argv, "ecdhk233") == 0) ecdh_doit[R_EC_K233] = 2; else if (strcmp(*argv, "ecdhk283") == 0) ecdh_doit[R_EC_K283] = 2; else if (strcmp(*argv, "ecdhk409") == 0) ecdh_doit[R_EC_K409] = 2; else if (strcmp(*argv, "ecdhk571") == 0) ecdh_doit[R_EC_K571] = 2; else if (strcmp(*argv, "ecdhb163") == 0) ecdh_doit[R_EC_B163] = 2; else if (strcmp(*argv, "ecdhb233") == 0) ecdh_doit[R_EC_B233] = 2; else if (strcmp(*argv, "ecdhb283") == 0) ecdh_doit[R_EC_B283] = 2; else if (strcmp(*argv, "ecdhb409") == 0) ecdh_doit[R_EC_B409] = 2; else if (strcmp(*argv, "ecdhb571") == 0) ecdh_doit[R_EC_B571] = 2; else if (strcmp(*argv, "ecdh") == 0) { for (i = 0; i < EC_NUM; i++) ecdh_doit[i] = 1; } else #endif { BIO_printf(bio_err, "Error: bad option or value\n"); BIO_printf(bio_err, "\n"); BIO_printf(bio_err, "Available values:\n"); #ifndef OPENSSL_NO_MD2 BIO_printf(bio_err, "md2 "); #endif #ifndef OPENSSL_NO_MDC2 BIO_printf(bio_err, "mdc2 "); #endif #ifndef OPENSSL_NO_MD4 BIO_printf(bio_err, "md4 "); #endif #ifndef OPENSSL_NO_MD5 BIO_printf(bio_err, "md5 "); BIO_printf(bio_err, "hmac "); #endif BIO_printf(bio_err, "sha1 "); BIO_printf(bio_err, "sha256 "); BIO_printf(bio_err, "sha512 "); #ifndef OPENSSL_NO_WHIRLPOOL BIO_printf(bio_err, "whirlpool"); #endif #ifndef OPENSSL_NO_RMD160 BIO_printf(bio_err, "rmd160"); #endif BIO_printf(bio_err, "\n"); #ifndef OPENSSL_NO_IDEA BIO_printf(bio_err, "idea-cbc "); #endif #ifndef OPENSSL_NO_SEED BIO_printf(bio_err, "seed-cbc "); #endif #ifndef OPENSSL_NO_RC2 BIO_printf(bio_err, "rc2-cbc "); #endif #ifndef OPENSSL_NO_RC5 BIO_printf(bio_err, "rc5-cbc "); #endif #ifndef OPENSSL_NO_BF BIO_printf(bio_err, "bf-cbc"); #endif #if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_SEED) || !defined(OPENSSL_NO_RC2) || \ !defined(OPENSSL_NO_BF) || !defined(OPENSSL_NO_RC5) BIO_printf(bio_err, "\n"); #endif #ifndef OPENSSL_NO_DES BIO_printf(bio_err, "des-cbc des-ede3 "); #endif #ifndef OPENSSL_NO_AES BIO_printf(bio_err, "aes-128-cbc aes-192-cbc aes-256-cbc "); BIO_printf(bio_err, "aes-128-ige aes-192-ige aes-256-ige "); #endif #ifndef OPENSSL_NO_CAMELLIA BIO_printf(bio_err, "\n"); BIO_printf(bio_err, "camellia-128-cbc camellia-192-cbc camellia-256-cbc "); #endif #ifndef OPENSSL_NO_RC4 BIO_printf(bio_err, "rc4"); #endif BIO_printf(bio_err, "\n"); #ifndef OPENSSL_NO_RSA BIO_printf(bio_err, "rsa512 rsa1024 rsa2048 rsa3072 rsa4096\n"); BIO_printf(bio_err, "rsa7680 rsa15360\n"); #endif #ifndef OPENSSL_NO_DSA BIO_printf(bio_err, "dsa512 dsa1024 dsa2048\n"); #endif #ifndef OPENSSL_NO_EC BIO_printf(bio_err, "ecdsap160 ecdsap192 ecdsap224 " "ecdsap256 ecdsap384 ecdsap521\n"); BIO_printf(bio_err, "ecdsak163 ecdsak233 ecdsak283 ecdsak409 ecdsak571\n"); BIO_printf(bio_err, "ecdsab163 ecdsab233 ecdsab283 ecdsab409 ecdsab571\n"); BIO_printf(bio_err, "ecdsa\n"); BIO_printf(bio_err, "ecdhp160 ecdhp192 ecdhp224 " "ecdhp256 ecdhp384 ecdhp521\n"); BIO_printf(bio_err, "ecdhk163 ecdhk233 ecdhk283 ecdhk409 ecdhk571\n"); BIO_printf(bio_err, "ecdhb163 ecdhb233 ecdhb283 ecdhb409 ecdhb571\n"); BIO_printf(bio_err, "ecdh\n"); #endif #ifndef OPENSSL_NO_IDEA BIO_printf(bio_err, "idea "); #endif #ifndef OPENSSL_NO_SEED BIO_printf(bio_err, "seed "); #endif #ifndef OPENSSL_NO_RC2 BIO_printf(bio_err, "rc2 "); #endif #ifndef OPENSSL_NO_DES BIO_printf(bio_err, "des "); #endif #ifndef OPENSSL_NO_AES BIO_printf(bio_err, "aes "); #endif #ifndef OPENSSL_NO_CAMELLIA BIO_printf(bio_err, "camellia "); #endif #ifndef OPENSSL_NO_RSA BIO_printf(bio_err, "rsa "); #endif #ifndef OPENSSL_NO_BF BIO_printf(bio_err, "blowfish"); #endif #if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_SEED) || \ !defined(OPENSSL_NO_RC2) || !defined(OPENSSL_NO_DES) || \ !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_BF) || \ !defined(OPENSSL_NO_AES) || !defined(OPENSSL_NO_CAMELLIA) BIO_printf(bio_err, "\n"); #endif BIO_printf(bio_err, "\n"); BIO_printf(bio_err, "Available options:\n"); #if defined(TIMES) || defined(USE_TOD) BIO_printf(bio_err, "-elapsed " "measure time in real time instead of CPU user time.\n"); #endif #ifndef OPENSSL_NO_ENGINE BIO_printf(bio_err, "-engine e " "use engine e, possibly a hardware device.\n"); #endif BIO_printf(bio_err, "-evp e " "use EVP e.\n"); BIO_printf(bio_err, "-decrypt " "time decryption instead of encryption (only EVP).\n"); BIO_printf(bio_err, "-mr " "produce machine readable output.\n"); BIO_printf(bio_err, "-mb " "perform multi-block benchmark (for specific ciphers)\n"); BIO_printf(bio_err, "-misalign n " "perform benchmark with misaligned data\n"); #ifndef NO_FORK BIO_printf(bio_err, "-multi n " "run n benchmarks in parallel.\n"); #endif goto end; } argc--; argv++; j++; } #ifndef NO_FORK if (multi && do_multi(multi)) goto show_res; #endif if (j == 0) { for (i = 0; i < ALGOR_NUM; i++) { if (i != D_EVP) doit[i] = 1; } for (i = 0; i < RSA_NUM; i++) rsa_doit[i] = 1; for (i = 0; i < DSA_NUM; i++) dsa_doit[i] = 1; #ifndef OPENSSL_NO_EC for (i = 0; i < EC_NUM; i++) ecdsa_doit[i] = 1; for (i = 0; i < EC_NUM; i++) ecdh_doit[i] = 1; #endif } for (i = 0; i < ALGOR_NUM; i++) if (doit[i]) pr_header++; if (usertime == 0 && !mr) BIO_printf(bio_err, "You have chosen to measure elapsed time " "instead of user CPU time.\n"); #ifndef OPENSSL_NO_RSA for (i = 0; i < RSA_NUM; i++) { const unsigned char *p; p = rsa_data[i]; rsa_key[i] = d2i_RSAPrivateKey(NULL, &p, rsa_data_length[i]); if (rsa_key[i] == NULL) { BIO_printf(bio_err, "internal error loading RSA key number %d\n", i); goto end; } } #endif #ifndef OPENSSL_NO_DSA dsa_key[0] = get_dsa512(); dsa_key[1] = get_dsa1024(); dsa_key[2] = get_dsa2048(); #endif #ifndef OPENSSL_NO_DES DES_set_key_unchecked(&key, &sch); DES_set_key_unchecked(&key2, &sch2); DES_set_key_unchecked(&key3, &sch3); #endif #ifndef OPENSSL_NO_AES AES_set_encrypt_key(key16, 128, &aes_ks1); AES_set_encrypt_key(key24, 192, &aes_ks2); AES_set_encrypt_key(key32, 256, &aes_ks3); #endif #ifndef OPENSSL_NO_CAMELLIA Camellia_set_key(key16, 128, &camellia_ks1); Camellia_set_key(ckey24, 192, &camellia_ks2); Camellia_set_key(ckey32, 256, &camellia_ks3); #endif #ifndef OPENSSL_NO_IDEA idea_set_encrypt_key(key16, &idea_ks); #endif #ifndef OPENSSL_NO_SEED SEED_set_key(key16, &seed_ks); #endif #ifndef OPENSSL_NO_RC4 RC4_set_key(&rc4_ks, 16, key16); #endif #ifndef OPENSSL_NO_RC2 RC2_set_key(&rc2_ks, 16, key16, 128); #endif #ifndef OPENSSL_NO_RC5 RC5_32_set_key(&rc5_ks, 16, key16, 12); #endif #ifndef OPENSSL_NO_BF BF_set_key(&bf_ks, 16, key16); #endif #ifndef OPENSSL_NO_CAST CAST_set_key(&cast_ks, 16, key16); #endif #ifndef OPENSSL_NO_RSA memset(rsa_c, 0, sizeof(rsa_c)); #endif #ifndef SIGALRM # ifndef OPENSSL_NO_DES BIO_printf(bio_err, "First we calculate the approximate speed ...\n"); count = 10; do { long it; count *= 2; Time_F(START); for (it = count; it; it--) DES_ecb_encrypt((DES_cblock *)buf, (DES_cblock *)buf, &sch, DES_ENCRYPT); d = Time_F(STOP); } while (d < 3); save_count = count; c[D_MD2][0] = count / 10; c[D_MDC2][0] = count / 10; c[D_MD4][0] = count; c[D_MD5][0] = count; c[D_HMAC][0] = count; c[D_SHA1][0] = count; c[D_RMD160][0] = count; c[D_RC4][0] = count * 5; c[D_CBC_DES][0] = count; c[D_EDE3_DES][0] = count / 3; c[D_CBC_IDEA][0] = count; c[D_CBC_SEED][0] = count; c[D_CBC_RC2][0] = count; c[D_CBC_RC5][0] = count; c[D_CBC_BF][0] = count; c[D_CBC_CAST][0] = count; c[D_CBC_128_AES][0] = count; c[D_CBC_192_AES][0] = count; c[D_CBC_256_AES][0] = count; c[D_CBC_128_CML][0] = count; c[D_CBC_192_CML][0] = count; c[D_CBC_256_CML][0] = count; c[D_SHA256][0] = count; c[D_SHA512][0] = count; c[D_WHIRLPOOL][0] = count; c[D_IGE_128_AES][0] = count; c[D_IGE_192_AES][0] = count; c[D_IGE_256_AES][0] = count; c[D_GHASH][0] = count; for (i = 1; i < SIZE_NUM; i++) { long l0, l1; l0 = (long)lengths[0]; l1 = (long)lengths[i]; c[D_MD2][i] = c[D_MD2][0] * 4 * l0 / l1; c[D_MDC2][i] = c[D_MDC2][0] * 4 * l0 / l1; c[D_MD4][i] = c[D_MD4][0] * 4 * l0 / l1; c[D_MD5][i] = c[D_MD5][0] * 4 * l0 / l1; c[D_HMAC][i] = c[D_HMAC][0] * 4 * l0 / l1; c[D_SHA1][i] = c[D_SHA1][0] * 4 * l0 / l1; c[D_RMD160][i] = c[D_RMD160][0] * 4 * l0 / l1; c[D_SHA256][i] = c[D_SHA256][0] * 4 * l0 / l1; c[D_SHA512][i] = c[D_SHA512][0] * 4 * l0 / l1; c[D_WHIRLPOOL][i] = c[D_WHIRLPOOL][0] * 4 * l0 / l1; l0 = (long)lengths[i - 1]; c[D_RC4][i] = c[D_RC4][i - 1] * l0 / l1; c[D_CBC_DES][i] = c[D_CBC_DES][i - 1] * l0 / l1; c[D_EDE3_DES][i] = c[D_EDE3_DES][i - 1] * l0 / l1; c[D_CBC_IDEA][i] = c[D_CBC_IDEA][i - 1] * l0 / l1; c[D_CBC_SEED][i] = c[D_CBC_SEED][i - 1] * l0 / l1; c[D_CBC_RC2][i] = c[D_CBC_RC2][i - 1] * l0 / l1; c[D_CBC_RC5][i] = c[D_CBC_RC5][i - 1] * l0 / l1; c[D_CBC_BF][i] = c[D_CBC_BF][i - 1] * l0 / l1; c[D_CBC_CAST][i] = c[D_CBC_CAST][i - 1] * l0 / l1; c[D_CBC_128_AES][i] = c[D_CBC_128_AES][i - 1] * l0 / l1; c[D_CBC_192_AES][i] = c[D_CBC_192_AES][i - 1] * l0 / l1; c[D_CBC_256_AES][i] = c[D_CBC_256_AES][i - 1] * l0 / l1; c[D_CBC_128_CML][i] = c[D_CBC_128_CML][i - 1] * l0 / l1; c[D_CBC_192_CML][i] = c[D_CBC_192_CML][i - 1] * l0 / l1; c[D_CBC_256_CML][i] = c[D_CBC_256_CML][i - 1] * l0 / l1; c[D_IGE_128_AES][i] = c[D_IGE_128_AES][i - 1] * l0 / l1; c[D_IGE_192_AES][i] = c[D_IGE_192_AES][i - 1] * l0 / l1; c[D_IGE_256_AES][i] = c[D_IGE_256_AES][i - 1] * l0 / l1; } # ifndef OPENSSL_NO_RSA rsa_c[R_RSA_512][0] = count / 2000; rsa_c[R_RSA_512][1] = count / 400; for (i = 1; i < RSA_NUM; i++) { rsa_c[i][0] = rsa_c[i - 1][0] / 8; rsa_c[i][1] = rsa_c[i - 1][1] / 4; if ((rsa_doit[i] <= 1) && (rsa_c[i][0] == 0)) rsa_doit[i] = 0; else { if (rsa_c[i][0] == 0) { rsa_c[i][0] = 1; rsa_c[i][1] = 20; } } } # endif # ifndef OPENSSL_NO_DSA dsa_c[R_DSA_512][0] = count / 1000; dsa_c[R_DSA_512][1] = count / 1000 / 2; for (i = 1; i < DSA_NUM; i++) { dsa_c[i][0] = dsa_c[i - 1][0] / 4; dsa_c[i][1] = dsa_c[i - 1][1] / 4; if ((dsa_doit[i] <= 1) && (dsa_c[i][0] == 0)) dsa_doit[i] = 0; else { if (dsa_c[i] == 0) { dsa_c[i][0] = 1; dsa_c[i][1] = 1; } } } # endif # ifndef OPENSSL_NO_EC ecdsa_c[R_EC_P160][0] = count / 1000; ecdsa_c[R_EC_P160][1] = count / 1000 / 2; for (i = R_EC_P192; i <= R_EC_P521; i++) { ecdsa_c[i][0] = ecdsa_c[i - 1][0] / 2; ecdsa_c[i][1] = ecdsa_c[i - 1][1] / 2; if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0)) ecdsa_doit[i] = 0; else { if (ecdsa_c[i] == 0) { ecdsa_c[i][0] = 1; ecdsa_c[i][1] = 1; } } } ecdsa_c[R_EC_K163][0] = count / 1000; ecdsa_c[R_EC_K163][1] = count / 1000 / 2; for (i = R_EC_K233; i <= R_EC_K571; i++) { ecdsa_c[i][0] = ecdsa_c[i - 1][0] / 2; ecdsa_c[i][1] = ecdsa_c[i - 1][1] / 2; if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0)) ecdsa_doit[i] = 0; else { if (ecdsa_c[i] == 0) { ecdsa_c[i][0] = 1; ecdsa_c[i][1] = 1; } } } ecdsa_c[R_EC_B163][0] = count / 1000; ecdsa_c[R_EC_B163][1] = count / 1000 / 2; for (i = R_EC_B233; i <= R_EC_B571; i++) { ecdsa_c[i][0] = ecdsa_c[i - 1][0] / 2; ecdsa_c[i][1] = ecdsa_c[i - 1][1] / 2; if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0)) ecdsa_doit[i] = 0; else { if (ecdsa_c[i] == 0) { ecdsa_c[i][0] = 1; ecdsa_c[i][1] = 1; } } } ecdh_c[R_EC_P160][0] = count / 1000; ecdh_c[R_EC_P160][1] = count / 1000; for (i = R_EC_P192; i <= R_EC_P521; i++) { ecdh_c[i][0] = ecdh_c[i - 1][0] / 2; ecdh_c[i][1] = ecdh_c[i - 1][1] / 2; if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0)) ecdh_doit[i] = 0; else { if (ecdh_c[i] == 0) { ecdh_c[i][0] = 1; ecdh_c[i][1] = 1; } } } ecdh_c[R_EC_K163][0] = count / 1000; ecdh_c[R_EC_K163][1] = count / 1000; for (i = R_EC_K233; i <= R_EC_K571; i++) { ecdh_c[i][0] = ecdh_c[i - 1][0] / 2; ecdh_c[i][1] = ecdh_c[i - 1][1] / 2; if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0)) ecdh_doit[i] = 0; else { if (ecdh_c[i] == 0) { ecdh_c[i][0] = 1; ecdh_c[i][1] = 1; } } } ecdh_c[R_EC_B163][0] = count / 1000; ecdh_c[R_EC_B163][1] = count / 1000; for (i = R_EC_B233; i <= R_EC_B571; i++) { ecdh_c[i][0] = ecdh_c[i - 1][0] / 2; ecdh_c[i][1] = ecdh_c[i - 1][1] / 2; if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0)) ecdh_doit[i] = 0; else { if (ecdh_c[i] == 0) { ecdh_c[i][0] = 1; ecdh_c[i][1] = 1; } } } # endif # define COND(d) (count < (d)) # define COUNT(d) (d) # else # error "You cannot disable DES on systems without SIGALRM." # endif #else # define COND(c) (run && count<0x7fffffff) # define COUNT(d) (count) # ifndef _WIN32 signal(SIGALRM, sig_done); # endif #endif #ifndef OPENSSL_NO_MD2 if (doit[D_MD2]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_MD2], c[D_MD2][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_MD2][j]); count++) EVP_Digest(buf, (unsigned long)lengths[j], &(md2[0]), NULL, EVP_md2(), NULL); d = Time_F(STOP); print_result(D_MD2, j, count, d); } } #endif #ifndef OPENSSL_NO_MDC2 if (doit[D_MDC2]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_MDC2], c[D_MDC2][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_MDC2][j]); count++) EVP_Digest(buf, (unsigned long)lengths[j], &(mdc2[0]), NULL, EVP_mdc2(), NULL); d = Time_F(STOP); print_result(D_MDC2, j, count, d); } } #endif #ifndef OPENSSL_NO_MD4 if (doit[D_MD4]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_MD4], c[D_MD4][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_MD4][j]); count++) EVP_Digest(&(buf[0]), (unsigned long)lengths[j], &(md4[0]), NULL, EVP_md4(), NULL); d = Time_F(STOP); print_result(D_MD4, j, count, d); } } #endif #ifndef OPENSSL_NO_MD5 if (doit[D_MD5]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_MD5], c[D_MD5][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_MD5][j]); count++) MD5(buf, lengths[j], md5); d = Time_F(STOP); print_result(D_MD5, j, count, d); } } #endif #if !defined(OPENSSL_NO_MD5) if (doit[D_HMAC]) { HMAC_CTX hctx; HMAC_CTX_init(&hctx); HMAC_Init_ex(&hctx, (unsigned char *)"This is a key...", 16, EVP_md5(), NULL); for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_HMAC], c[D_HMAC][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_HMAC][j]); count++) { HMAC_Init_ex(&hctx, NULL, 0, NULL, NULL); HMAC_Update(&hctx, buf, lengths[j]); HMAC_Final(&hctx, &(hmac[0]), NULL); } d = Time_F(STOP); print_result(D_HMAC, j, count, d); } HMAC_CTX_cleanup(&hctx); } #endif if (doit[D_SHA1]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_SHA1], c[D_SHA1][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_SHA1][j]); count++) SHA1(buf, lengths[j], sha); d = Time_F(STOP); print_result(D_SHA1, j, count, d); } } if (doit[D_SHA256]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_SHA256], c[D_SHA256][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_SHA256][j]); count++) SHA256(buf, lengths[j], sha256); d = Time_F(STOP); print_result(D_SHA256, j, count, d); } } if (doit[D_SHA512]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_SHA512], c[D_SHA512][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_SHA512][j]); count++) SHA512(buf, lengths[j], sha512); d = Time_F(STOP); print_result(D_SHA512, j, count, d); } } #ifndef OPENSSL_NO_WHIRLPOOL if (doit[D_WHIRLPOOL]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_WHIRLPOOL], c[D_WHIRLPOOL][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_WHIRLPOOL][j]); count++) WHIRLPOOL(buf, lengths[j], whirlpool); d = Time_F(STOP); print_result(D_WHIRLPOOL, j, count, d); } } #endif #ifndef OPENSSL_NO_RMD160 if (doit[D_RMD160]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_RMD160], c[D_RMD160][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_RMD160][j]); count++) EVP_Digest(buf, (unsigned long)lengths[j], &(rmd160[0]), NULL, EVP_ripemd160(), NULL); d = Time_F(STOP); print_result(D_RMD160, j, count, d); } } #endif #ifndef OPENSSL_NO_RC4 if (doit[D_RC4]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_RC4], c[D_RC4][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_RC4][j]); count++) RC4(&rc4_ks, (unsigned int)lengths[j], buf, buf); d = Time_F(STOP); print_result(D_RC4, j, count, d); } } #endif #ifndef OPENSSL_NO_DES if (doit[D_CBC_DES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_DES], c[D_CBC_DES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_DES][j]); count++) DES_ncbc_encrypt(buf, buf, lengths[j], &sch, &DES_iv, DES_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_DES, j, count, d); } } if (doit[D_EDE3_DES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_EDE3_DES], c[D_EDE3_DES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_EDE3_DES][j]); count++) DES_ede3_cbc_encrypt(buf, buf, lengths[j], &sch, &sch2, &sch3, &DES_iv, DES_ENCRYPT); d = Time_F(STOP); print_result(D_EDE3_DES, j, count, d); } } #endif #ifndef OPENSSL_NO_AES if (doit[D_CBC_128_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_128_AES], c[D_CBC_128_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_128_AES][j]); count++) AES_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &aes_ks1, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_128_AES, j, count, d); } } if (doit[D_CBC_192_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_192_AES], c[D_CBC_192_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_192_AES][j]); count++) AES_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &aes_ks2, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_192_AES, j, count, d); } } if (doit[D_CBC_256_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_256_AES], c[D_CBC_256_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_256_AES][j]); count++) AES_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &aes_ks3, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_256_AES, j, count, d); } } if (doit[D_IGE_128_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_IGE_128_AES], c[D_IGE_128_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_IGE_128_AES][j]); count++) AES_ige_encrypt(buf, buf2, (unsigned long)lengths[j], &aes_ks1, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_IGE_128_AES, j, count, d); } } if (doit[D_IGE_192_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_IGE_192_AES], c[D_IGE_192_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_IGE_192_AES][j]); count++) AES_ige_encrypt(buf, buf2, (unsigned long)lengths[j], &aes_ks2, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_IGE_192_AES, j, count, d); } } if (doit[D_IGE_256_AES]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_IGE_256_AES], c[D_IGE_256_AES][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_IGE_256_AES][j]); count++) AES_ige_encrypt(buf, buf2, (unsigned long)lengths[j], &aes_ks3, iv, AES_ENCRYPT); d = Time_F(STOP); print_result(D_IGE_256_AES, j, count, d); } } if (doit[D_GHASH]) { GCM128_CONTEXT *ctx = CRYPTO_gcm128_new(&aes_ks1, (block128_f) AES_encrypt); CRYPTO_gcm128_setiv(ctx, (unsigned char *)"0123456789ab", 12); for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_GHASH], c[D_GHASH][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_GHASH][j]); count++) CRYPTO_gcm128_aad(ctx, buf, lengths[j]); d = Time_F(STOP); print_result(D_GHASH, j, count, d); } CRYPTO_gcm128_release(ctx); } #endif #ifndef OPENSSL_NO_CAMELLIA if (doit[D_CBC_128_CML]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_128_CML], c[D_CBC_128_CML][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_128_CML][j]); count++) Camellia_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &camellia_ks1, iv, CAMELLIA_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_128_CML, j, count, d); } } if (doit[D_CBC_192_CML]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_192_CML], c[D_CBC_192_CML][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_192_CML][j]); count++) Camellia_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &camellia_ks2, iv, CAMELLIA_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_192_CML, j, count, d); } } if (doit[D_CBC_256_CML]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_256_CML], c[D_CBC_256_CML][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_256_CML][j]); count++) Camellia_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &camellia_ks3, iv, CAMELLIA_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_256_CML, j, count, d); } } #endif #ifndef OPENSSL_NO_IDEA if (doit[D_CBC_IDEA]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_IDEA], c[D_CBC_IDEA][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_IDEA][j]); count++) idea_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &idea_ks, iv, IDEA_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_IDEA, j, count, d); } } #endif #ifndef OPENSSL_NO_SEED if (doit[D_CBC_SEED]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_SEED], c[D_CBC_SEED][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_SEED][j]); count++) SEED_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &seed_ks, iv, 1); d = Time_F(STOP); print_result(D_CBC_SEED, j, count, d); } } #endif #ifndef OPENSSL_NO_RC2 if (doit[D_CBC_RC2]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_RC2], c[D_CBC_RC2][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_RC2][j]); count++) RC2_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &rc2_ks, iv, RC2_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_RC2, j, count, d); } } #endif #ifndef OPENSSL_NO_RC5 if (doit[D_CBC_RC5]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_RC5], c[D_CBC_RC5][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_RC5][j]); count++) RC5_32_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &rc5_ks, iv, RC5_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_RC5, j, count, d); } } #endif #ifndef OPENSSL_NO_BF if (doit[D_CBC_BF]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_BF], c[D_CBC_BF][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_BF][j]); count++) BF_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &bf_ks, iv, BF_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_BF, j, count, d); } } #endif #ifndef OPENSSL_NO_CAST if (doit[D_CBC_CAST]) { for (j = 0; j < SIZE_NUM; j++) { print_message(names[D_CBC_CAST], c[D_CBC_CAST][j], lengths[j]); Time_F(START); for (count = 0, run = 1; COND(c[D_CBC_CAST][j]); count++) CAST_cbc_encrypt(buf, buf, (unsigned long)lengths[j], &cast_ks, iv, CAST_ENCRYPT); d = Time_F(STOP); print_result(D_CBC_CAST, j, count, d); } } #endif if (doit[D_EVP]) { #ifdef EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK if (multiblock && evp_cipher) { if (! (EVP_CIPHER_flags(evp_cipher) & EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK)) { fprintf(stderr, "%s is not multi-block capable\n", OBJ_nid2ln(evp_cipher->nid)); goto end; } multiblock_speed(evp_cipher); mret = 0; goto end; } #endif for (j = 0; j < SIZE_NUM; j++) { if (evp_cipher) { EVP_CIPHER_CTX ctx; int outl; names[D_EVP] = OBJ_nid2ln(evp_cipher->nid); print_message(names[D_EVP], save_count, lengths[j]); EVP_CIPHER_CTX_init(&ctx); if (decrypt) EVP_DecryptInit_ex(&ctx, evp_cipher, NULL, key16, iv); else EVP_EncryptInit_ex(&ctx, evp_cipher, NULL, key16, iv); EVP_CIPHER_CTX_set_padding(&ctx, 0); Time_F(START); if (decrypt) for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++) EVP_DecryptUpdate(&ctx, buf, &outl, buf, lengths[j]); else for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++) EVP_EncryptUpdate(&ctx, buf, &outl, buf, lengths[j]); if (decrypt) EVP_DecryptFinal_ex(&ctx, buf, &outl); else EVP_EncryptFinal_ex(&ctx, buf, &outl); d = Time_F(STOP); EVP_CIPHER_CTX_cleanup(&ctx); } if (evp_md) { names[D_EVP] = OBJ_nid2ln(evp_md->type); print_message(names[D_EVP], save_count, lengths[j]); Time_F(START); for (count = 0, run = 1; COND(save_count * 4 * lengths[0] / lengths[j]); count++) EVP_Digest(buf, lengths[j], &(md[0]), NULL, evp_md, NULL); d = Time_F(STOP); } print_result(D_EVP, j, count, d); } } #ifndef OPENSSL_SYS_WIN32 #endif RAND_pseudo_bytes(buf, 36); #ifndef OPENSSL_NO_RSA for (j = 0; j < RSA_NUM; j++) { int ret; if (!rsa_doit[j]) continue; ret = RSA_sign(NID_md5_sha1, buf, 36, buf2, &rsa_num, rsa_key[j]); if (ret == 0) { BIO_printf(bio_err, "RSA sign failure. No RSA sign will be done.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { pkey_print_message("private", "rsa", rsa_c[j][0], rsa_bits[j], RSA_SECONDS); Time_F(START); for (count = 0, run = 1; COND(rsa_c[j][0]); count++) { ret = RSA_sign(NID_md5_sha1, buf, 36, buf2, &rsa_num, rsa_key[j]); if (ret == 0) { BIO_printf(bio_err, "RSA sign failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R1:%ld:%d:%.2f\n" : "%ld %d bit private RSA's in %.2fs\n", count, rsa_bits[j], d); rsa_results[j][0] = d / (double)count; rsa_count = count; } ret = RSA_verify(NID_md5_sha1, buf, 36, buf2, rsa_num, rsa_key[j]); if (ret <= 0) { BIO_printf(bio_err, "RSA verify failure. No RSA verify will be done.\n"); ERR_print_errors(bio_err); rsa_doit[j] = 0; } else { pkey_print_message("public", "rsa", rsa_c[j][1], rsa_bits[j], RSA_SECONDS); Time_F(START); for (count = 0, run = 1; COND(rsa_c[j][1]); count++) { ret = RSA_verify(NID_md5_sha1, buf, 36, buf2, rsa_num, rsa_key[j]); if (ret <= 0) { BIO_printf(bio_err, "RSA verify failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R2:%ld:%d:%.2f\n" : "%ld %d bit public RSA's in %.2fs\n", count, rsa_bits[j], d); rsa_results[j][1] = d / (double)count; } if (rsa_count <= 1) { for (j++; j < RSA_NUM; j++) rsa_doit[j] = 0; } } #endif RAND_pseudo_bytes(buf, 20); #ifndef OPENSSL_NO_DSA if (RAND_status() != 1) { RAND_seed(rnd_seed, sizeof rnd_seed); rnd_fake = 1; } for (j = 0; j < DSA_NUM; j++) { unsigned int kk; int ret; if (!dsa_doit[j]) continue; ret = DSA_sign(EVP_PKEY_DSA, buf, 20, buf2, &kk, dsa_key[j]); if (ret == 0) { BIO_printf(bio_err, "DSA sign failure. No DSA sign will be done.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { pkey_print_message("sign", "dsa", dsa_c[j][0], dsa_bits[j], DSA_SECONDS); Time_F(START); for (count = 0, run = 1; COND(dsa_c[j][0]); count++) { ret = DSA_sign(EVP_PKEY_DSA, buf, 20, buf2, &kk, dsa_key[j]); if (ret == 0) { BIO_printf(bio_err, "DSA sign failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R3:%ld:%d:%.2f\n" : "%ld %d bit DSA signs in %.2fs\n", count, dsa_bits[j], d); dsa_results[j][0] = d / (double)count; rsa_count = count; } ret = DSA_verify(EVP_PKEY_DSA, buf, 20, buf2, kk, dsa_key[j]); if (ret <= 0) { BIO_printf(bio_err, "DSA verify failure. No DSA verify will be done.\n"); ERR_print_errors(bio_err); dsa_doit[j] = 0; } else { pkey_print_message("verify", "dsa", dsa_c[j][1], dsa_bits[j], DSA_SECONDS); Time_F(START); for (count = 0, run = 1; COND(dsa_c[j][1]); count++) { ret = DSA_verify(EVP_PKEY_DSA, buf, 20, buf2, kk, dsa_key[j]); if (ret <= 0) { BIO_printf(bio_err, "DSA verify failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R4:%ld:%d:%.2f\n" : "%ld %d bit DSA verify in %.2fs\n", count, dsa_bits[j], d); dsa_results[j][1] = d / (double)count; } if (rsa_count <= 1) { for (j++; j < DSA_NUM; j++) dsa_doit[j] = 0; } } if (rnd_fake) RAND_cleanup(); #endif #ifndef OPENSSL_NO_EC if (RAND_status() != 1) { RAND_seed(rnd_seed, sizeof rnd_seed); rnd_fake = 1; } for (j = 0; j < EC_NUM; j++) { int ret; if (!ecdsa_doit[j]) continue; ecdsa[j] = EC_KEY_new_by_curve_name(test_curves[j]); if (ecdsa[j] == NULL) { BIO_printf(bio_err, "ECDSA failure.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { EC_KEY_precompute_mult(ecdsa[j], NULL); EC_KEY_generate_key(ecdsa[j]); ret = ECDSA_sign(0, buf, 20, ecdsasig, &ecdsasiglen, ecdsa[j]); if (ret == 0) { BIO_printf(bio_err, "ECDSA sign failure. No ECDSA sign will be done.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { pkey_print_message("sign", "ecdsa", ecdsa_c[j][0], test_curves_bits[j], ECDSA_SECONDS); Time_F(START); for (count = 0, run = 1; COND(ecdsa_c[j][0]); count++) { ret = ECDSA_sign(0, buf, 20, ecdsasig, &ecdsasiglen, ecdsa[j]); if (ret == 0) { BIO_printf(bio_err, "ECDSA sign failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R5:%ld:%d:%.2f\n" : "%ld %d bit ECDSA signs in %.2fs \n", count, test_curves_bits[j], d); ecdsa_results[j][0] = d / (double)count; rsa_count = count; } ret = ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen, ecdsa[j]); if (ret != 1) { BIO_printf(bio_err, "ECDSA verify failure. No ECDSA verify will be done.\n"); ERR_print_errors(bio_err); ecdsa_doit[j] = 0; } else { pkey_print_message("verify", "ecdsa", ecdsa_c[j][1], test_curves_bits[j], ECDSA_SECONDS); Time_F(START); for (count = 0, run = 1; COND(ecdsa_c[j][1]); count++) { ret = ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen, ecdsa[j]); if (ret != 1) { BIO_printf(bio_err, "ECDSA verify failure\n"); ERR_print_errors(bio_err); count = 1; break; } } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R6:%ld:%d:%.2f\n" : "%ld %d bit ECDSA verify in %.2fs\n", count, test_curves_bits[j], d); ecdsa_results[j][1] = d / (double)count; } if (rsa_count <= 1) { for (j++; j < EC_NUM; j++) ecdsa_doit[j] = 0; } } } if (rnd_fake) RAND_cleanup(); if (RAND_status() != 1) { RAND_seed(rnd_seed, sizeof rnd_seed); rnd_fake = 1; } for (j = 0; j < EC_NUM; j++) { if (!ecdh_doit[j]) continue; ecdh_a[j] = EC_KEY_new_by_curve_name(test_curves[j]); ecdh_b[j] = EC_KEY_new_by_curve_name(test_curves[j]); if ((ecdh_a[j] == NULL) || (ecdh_b[j] == NULL)) { BIO_printf(bio_err, "ECDH failure.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { if (!EC_KEY_generate_key(ecdh_a[j]) || !EC_KEY_generate_key(ecdh_b[j])) { BIO_printf(bio_err, "ECDH key generation failure.\n"); ERR_print_errors(bio_err); rsa_count = 1; } else { int field_size, outlen; void *(*kdf) (const void *in, size_t inlen, void *out, size_t *xoutlen); field_size = EC_GROUP_get_degree(EC_KEY_get0_group(ecdh_a[j])); if (field_size <= 24 * 8) { outlen = KDF1_SHA1_len; kdf = KDF1_SHA1; } else { outlen = (field_size + 7) / 8; kdf = NULL; } secret_size_a = ECDH_compute_key(secret_a, outlen, EC_KEY_get0_public_key(ecdh_b[j]), ecdh_a[j], kdf); secret_size_b = ECDH_compute_key(secret_b, outlen, EC_KEY_get0_public_key(ecdh_a[j]), ecdh_b[j], kdf); if (secret_size_a != secret_size_b) ecdh_checks = 0; else ecdh_checks = 1; for (secret_idx = 0; (secret_idx < secret_size_a) && (ecdh_checks == 1); secret_idx++) { if (secret_a[secret_idx] != secret_b[secret_idx]) ecdh_checks = 0; } if (ecdh_checks == 0) { BIO_printf(bio_err, "ECDH computations don't match.\n"); ERR_print_errors(bio_err); rsa_count = 1; } pkey_print_message("", "ecdh", ecdh_c[j][0], test_curves_bits[j], ECDH_SECONDS); Time_F(START); for (count = 0, run = 1; COND(ecdh_c[j][0]); count++) { ECDH_compute_key(secret_a, outlen, EC_KEY_get0_public_key(ecdh_b[j]), ecdh_a[j], kdf); } d = Time_F(STOP); BIO_printf(bio_err, mr ? "+R7:%ld:%d:%.2f\n" : "%ld %d-bit ECDH ops in %.2fs\n", count, test_curves_bits[j], d); ecdh_results[j][0] = d / (double)count; rsa_count = count; } } if (rsa_count <= 1) { for (j++; j < EC_NUM; j++) ecdh_doit[j] = 0; } } if (rnd_fake) RAND_cleanup(); #endif #ifndef NO_FORK show_res: #endif if (!mr) { fprintf(stdout, "%s\n", SSLeay_version(SSLEAY_VERSION)); fprintf(stdout, "%s\n", SSLeay_version(SSLEAY_BUILT_ON)); printf("options:"); printf("%s ", BN_options()); #ifndef OPENSSL_NO_MD2 printf("%s ", MD2_options()); #endif #ifndef OPENSSL_NO_RC4 printf("%s ", RC4_options()); #endif #ifndef OPENSSL_NO_DES printf("%s ", DES_options()); #endif #ifndef OPENSSL_NO_AES printf("%s ", AES_options()); #endif #ifndef OPENSSL_NO_IDEA printf("%s ", idea_options()); #endif #ifndef OPENSSL_NO_BF printf("%s ", BF_options()); #endif fprintf(stdout, "\n%s\n", SSLeay_version(SSLEAY_CFLAGS)); } if (pr_header) { if (mr) fprintf(stdout, "+H"); else { fprintf(stdout, "The 'numbers' are in 1000s of bytes per second processed.\n"); fprintf(stdout, "type "); } for (j = 0; j < SIZE_NUM; j++) fprintf(stdout, mr ? ":%d" : "%7d bytes", lengths[j]); fprintf(stdout, "\n"); } for (k = 0; k < ALGOR_NUM; k++) { if (!doit[k]) continue; if (mr) fprintf(stdout, "+F:%d:%s", k, names[k]); else fprintf(stdout, "%-13s", names[k]); for (j = 0; j < SIZE_NUM; j++) { if (results[k][j] > 10000 && !mr) fprintf(stdout, " %11.2fk", results[k][j] / 1e3); else fprintf(stdout, mr ? ":%.2f" : " %11.2f ", results[k][j]); } fprintf(stdout, "\n"); } #ifndef OPENSSL_NO_RSA j = 1; for (k = 0; k < RSA_NUM; k++) { if (!rsa_doit[k]) continue; if (j && !mr) { printf("%18ssign verify sign/s verify/s\n", " "); j = 0; } if (mr) fprintf(stdout, "+F2:%u:%u:%f:%f\n", k, rsa_bits[k], rsa_results[k][0], rsa_results[k][1]); else fprintf(stdout, "rsa %4u bits %8.6fs %8.6fs %8.1f %8.1f\n", rsa_bits[k], rsa_results[k][0], rsa_results[k][1], 1.0 / rsa_results[k][0], 1.0 / rsa_results[k][1]); } #endif #ifndef OPENSSL_NO_DSA j = 1; for (k = 0; k < DSA_NUM; k++) { if (!dsa_doit[k]) continue; if (j && !mr) { printf("%18ssign verify sign/s verify/s\n", " "); j = 0; } if (mr) fprintf(stdout, "+F3:%u:%u:%f:%f\n", k, dsa_bits[k], dsa_results[k][0], dsa_results[k][1]); else fprintf(stdout, "dsa %4u bits %8.6fs %8.6fs %8.1f %8.1f\n", dsa_bits[k], dsa_results[k][0], dsa_results[k][1], 1.0 / dsa_results[k][0], 1.0 / dsa_results[k][1]); } #endif #ifndef OPENSSL_NO_EC j = 1; for (k = 0; k < EC_NUM; k++) { if (!ecdsa_doit[k]) continue; if (j && !mr) { printf("%30ssign verify sign/s verify/s\n", " "); j = 0; } if (mr) fprintf(stdout, "+F4:%u:%u:%f:%f\n", k, test_curves_bits[k], ecdsa_results[k][0], ecdsa_results[k][1]); else fprintf(stdout, "%4u bit ecdsa (%s) %8.4fs %8.4fs %8.1f %8.1f\n", test_curves_bits[k], test_curves_names[k], ecdsa_results[k][0], ecdsa_results[k][1], 1.0 / ecdsa_results[k][0], 1.0 / ecdsa_results[k][1]); } j = 1; for (k = 0; k < EC_NUM; k++) { if (!ecdh_doit[k]) continue; if (j && !mr) { printf("%30sop op/s\n", " "); j = 0; } if (mr) fprintf(stdout, "+F5:%u:%u:%f:%f\n", k, test_curves_bits[k], ecdh_results[k][0], 1.0 / ecdh_results[k][0]); else fprintf(stdout, "%4u bit ecdh (%s) %8.4fs %8.1f\n", test_curves_bits[k], test_curves_names[k], ecdh_results[k][0], 1.0 / ecdh_results[k][0]); } #endif mret = 0; end: ERR_print_errors(bio_err); if (buf_malloc != NULL) OPENSSL_free(buf_malloc); if (buf2_malloc != NULL) OPENSSL_free(buf2_malloc); #ifndef OPENSSL_NO_RSA for (i = 0; i < RSA_NUM; i++) if (rsa_key[i] != NULL) RSA_free(rsa_key[i]); #endif #ifndef OPENSSL_NO_DSA for (i = 0; i < DSA_NUM; i++) if (dsa_key[i] != NULL) DSA_free(dsa_key[i]); #endif #ifndef OPENSSL_NO_EC for (i = 0; i < EC_NUM; i++) if (ecdsa[i] != NULL) EC_KEY_free(ecdsa[i]); for (i = 0; i < EC_NUM; i++) { if (ecdh_a[i] != NULL) EC_KEY_free(ecdh_a[i]); if (ecdh_b[i] != NULL) EC_KEY_free(ecdh_b[i]); } #endif apps_shutdown(); OPENSSL_EXIT(mret); } apps/speed.c:2462: error: UNINITIALIZED_VALUE The value read from ecdsa[_] was never initialized. Showing all 1 steps of the trace apps/speed.c:2462:13: 2460. #ifndef OPENSSL_NO_EC 2461. for (i = 0; i < EC_NUM; i++) 2462. > if (ecdsa[i] != NULL) 2463. EC_KEY_free(ecdsa[i]); 2464. for (i = 0; i < EC_NUM; i++) {
https://github.com/openssl/openssl/blob/6b937f8b115d817b00116bc6291d604b16dc4602/apps/speed.c/#L2462
d2a_code_trace_data_45925
int test_mont(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *c, *d, *A, *B; BIGNUM *n; int i; BN_MONT_CTX *mont; a = BN_new(); b = BN_new(); c = BN_new(); d = BN_new(); A = BN_new(); B = BN_new(); n = BN_new(); mont = BN_MONT_CTX_new(); if (mont == NULL) return 0; BN_zero(n); if (BN_MONT_CTX_set(mont, n, ctx)) { fprintf(stderr, "BN_MONT_CTX_set succeeded for zero modulus!\n"); return 0; } BN_set_word(n, 16); if (BN_MONT_CTX_set(mont, n, ctx)) { fprintf(stderr, "BN_MONT_CTX_set succeeded for even modulus!\n"); return 0; } BN_bntest_rand(a, 100, 0, 0); BN_bntest_rand(b, 100, 0, 0); for (i = 0; i < num2; i++) { int bits = (200 * (i + 1)) / num2; if (bits == 0) continue; BN_bntest_rand(n, bits, 0, 1); BN_MONT_CTX_set(mont, n, ctx); BN_nnmod(a, a, n, ctx); BN_nnmod(b, b, n, ctx); BN_to_montgomery(A, a, mont, ctx); BN_to_montgomery(B, b, mont, ctx); BN_mod_mul_montgomery(c, A, B, mont, ctx); BN_from_montgomery(A, c, mont, ctx); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " * "); BN_print(bp, b); BIO_puts(bp, " % "); BN_print(bp, &mont->N); BIO_puts(bp, " - "); } BN_print(bp, A); BIO_puts(bp, "\n"); } BN_mod_mul(d, a, b, n, ctx); BN_sub(d, d, A); if (!BN_is_zero(d)) { fprintf(stderr, "Montgomery multiplication test failed!\n"); return 0; } } BN_MONT_CTX_free(mont); BN_free(a); BN_free(b); BN_free(c); BN_free(d); BN_free(A); BN_free(B); BN_free(n); return (1); } test/bntest.c:802: error: MEMORY_LEAK memory dynamically allocated to `return` by call to `BN_new()` at line 793, column 9 is not reachable after line 802, column 9. Showing all 172 steps of the trace test/bntest.c:785:1: start of procedure test_mont() 783. } 784. 785. > int test_mont(BIO *bp, BN_CTX *ctx) 786. { 787. BIGNUM *a, *b, *c, *d, *A, *B; test/bntest.c:792:5: 790. BN_MONT_CTX *mont; 791. 792. > a = BN_new(); 793. b = BN_new(); 794. c = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:793:5: 791. 792. a = BN_new(); 793. > b = BN_new(); 794. c = BN_new(); 795. d = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:794:5: 792. a = BN_new(); 793. b = BN_new(); 794. > c = BN_new(); 795. d = BN_new(); 796. A = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:795:5: 793. b = BN_new(); 794. c = BN_new(); 795. > d = BN_new(); 796. A = BN_new(); 797. B = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:796:5: 794. c = BN_new(); 795. d = BN_new(); 796. > A = BN_new(); 797. B = BN_new(); 798. n = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:797:5: 795. d = BN_new(); 796. A = BN_new(); 797. > B = BN_new(); 798. n = BN_new(); 799. crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:798:5: 796. A = BN_new(); 797. B = BN_new(); 798. > n = BN_new(); 799. 800. mont = BN_MONT_CTX_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:800:5: 798. n = BN_new(); 799. 800. > mont = BN_MONT_CTX_new(); 801. if (mont == NULL) 802. return 0; crypto/bn/bn_mont.c:315:1: start of procedure BN_MONT_CTX_new() 313. } 314. 315. > BN_MONT_CTX *BN_MONT_CTX_new(void) 316. { 317. BN_MONT_CTX *ret; crypto/bn/bn_mont.c:319:9: 317. BN_MONT_CTX *ret; 318. 319. > if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) 320. return (NULL); 321. crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/bn/bn_mont.c:319:9: Taking true branch 317. BN_MONT_CTX *ret; 318. 319. if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) ^ 320. return (NULL); 321. crypto/bn/bn_mont.c:320:9: 318. 319. if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) 320. > return (NULL); 321. 322. BN_MONT_CTX_init(ret); crypto/bn/bn_mont.c:325:1: return from a call to BN_MONT_CTX_new 323. ret->flags = BN_FLG_MALLOCED; 324. return (ret); 325. > } 326. 327. void BN_MONT_CTX_init(BN_MONT_CTX *ctx) test/bntest.c:801:9: Taking true branch 799. 800. mont = BN_MONT_CTX_new(); 801. if (mont == NULL) ^ 802. return 0; 803. test/bntest.c:802:9: 800. mont = BN_MONT_CTX_new(); 801. if (mont == NULL) 802. > return 0; 803. 804. BN_zero(n);
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L802
d2a_code_trace_data_45926
static int init_context_frame(MpegEncContext *s) { int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y; s->mb_width = (s->width + 15) / 16; s->mb_stride = s->mb_width + 1; s->b8_stride = s->mb_width * 2 + 1; mb_array_size = s->mb_height * s->mb_stride; mv_table_size = (s->mb_height + 2) * s->mb_stride + 1; s->h_edge_pos = s->mb_width * 16; s->v_edge_pos = s->mb_height * 16; s->mb_num = s->mb_width * s->mb_height; s->block_wrap[0] = s->block_wrap[1] = s->block_wrap[2] = s->block_wrap[3] = s->b8_stride; s->block_wrap[4] = s->block_wrap[5] = s->mb_stride; y_size = s->b8_stride * (2 * s->mb_height + 1); c_size = s->mb_stride * (s->mb_height + 1); yc_size = y_size + 2 * c_size; FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), fail); for (y = 0; y < s->mb_height; y++) for (x = 0; x < s->mb_width; x++) s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride; s->mb_index2xy[s->mb_height * s->mb_width] = (s->mb_height - 1) * s->mb_stride + s->mb_width; if (s->encoding) { FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); s->p_mv_table = s->p_mv_table_base + s->mb_stride + 1; s->b_forw_mv_table = s->b_forw_mv_table_base + s->mb_stride + 1; s->b_back_mv_table = s->b_back_mv_table_base + s->mb_stride + 1; s->b_bidir_forw_mv_table = s->b_bidir_forw_mv_table_base + s->mb_stride + 1; s->b_bidir_back_mv_table = s->b_bidir_back_mv_table_base + s->mb_stride + 1; s->b_direct_mv_table = s->b_direct_mv_table_base + s->mb_stride + 1; FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_type, mb_array_size * sizeof(uint16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->lambda_table, mb_array_size * sizeof(int), fail); FF_ALLOC_OR_GOTO(s->avctx, s->cplx_tab, mb_array_size * sizeof(float), fail); FF_ALLOC_OR_GOTO(s->avctx, s->bits_tab, mb_array_size * sizeof(float), fail); } if (s->codec_id == AV_CODEC_ID_MPEG4 || (s->flags & CODEC_FLAG_INTERLACED_ME)) { for (i = 0; i < 2; i++) { int j, k; for (j = 0; j < 2; j++) { for (k = 0; k < 2; k++) { FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_mv_table_base[i][j][k], mv_table_size * 2 * sizeof(int16_t), fail); s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] + s->mb_stride + 1; } FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_select_table [i][j], mb_array_size * 2 * sizeof(uint8_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_mv_table_base[i][j], mv_table_size * 2 * sizeof(int16_t), fail); s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j] + s->mb_stride + 1; } FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_select_table[i], mb_array_size * 2 * sizeof(uint8_t), fail); } } if (s->out_format == FMT_H263) { FF_ALLOCZ_OR_GOTO(s->avctx, s->coded_block_base, y_size, fail); s->coded_block = s->coded_block_base + s->b8_stride + 1; FF_ALLOCZ_OR_GOTO(s->avctx, s->cbp_table, mb_array_size * sizeof(uint8_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->pred_dir_table, mb_array_size * sizeof(uint8_t), fail); } if (s->h263_pred || s->h263_plus || !s->encoding) { FF_ALLOCZ_OR_GOTO(s->avctx, s->dc_val_base, yc_size * sizeof(int16_t), fail); s->dc_val[0] = s->dc_val_base + s->b8_stride + 1; s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1; s->dc_val[2] = s->dc_val[1] + c_size; for (i = 0; i < yc_size; i++) s->dc_val_base[i] = 1024; } FF_ALLOCZ_OR_GOTO(s->avctx, s->mbintra_table, mb_array_size, fail); memset(s->mbintra_table, 1, mb_array_size); FF_ALLOCZ_OR_GOTO(s->avctx, s->mbskip_table, mb_array_size + 2, fail); return init_er(s); fail: return AVERROR(ENOMEM); } libavcodec/mpegvideo.c:1129: error: Null Dereference pointer `s->mb_index2xy` last assigned on line 1123 could be null and is dereferenced at line 1129, column 5. libavcodec/mpegvideo.c:1095:1: start of procedure init_context_frame() 1093. * Initialize and allocates MpegEncContext fields dependent on the resolution. 1094. */ 1095. static int init_context_frame(MpegEncContext *s) ^ 1096. { 1097. int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y; libavcodec/mpegvideo.c:1099:5: 1097. int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y; 1098. 1099. s->mb_width = (s->width + 15) / 16; ^ 1100. s->mb_stride = s->mb_width + 1; 1101. s->b8_stride = s->mb_width * 2 + 1; libavcodec/mpegvideo.c:1100:5: 1098. 1099. s->mb_width = (s->width + 15) / 16; 1100. s->mb_stride = s->mb_width + 1; ^ 1101. s->b8_stride = s->mb_width * 2 + 1; 1102. mb_array_size = s->mb_height * s->mb_stride; libavcodec/mpegvideo.c:1101:5: 1099. s->mb_width = (s->width + 15) / 16; 1100. s->mb_stride = s->mb_width + 1; 1101. s->b8_stride = s->mb_width * 2 + 1; ^ 1102. mb_array_size = s->mb_height * s->mb_stride; 1103. mv_table_size = (s->mb_height + 2) * s->mb_stride + 1; libavcodec/mpegvideo.c:1102:5: 1100. s->mb_stride = s->mb_width + 1; 1101. s->b8_stride = s->mb_width * 2 + 1; 1102. mb_array_size = s->mb_height * s->mb_stride; ^ 1103. mv_table_size = (s->mb_height + 2) * s->mb_stride + 1; 1104. libavcodec/mpegvideo.c:1103:5: 1101. s->b8_stride = s->mb_width * 2 + 1; 1102. mb_array_size = s->mb_height * s->mb_stride; 1103. mv_table_size = (s->mb_height + 2) * s->mb_stride + 1; ^ 1104. 1105. /* set default edge pos, will be overriden libavcodec/mpegvideo.c:1107:5: 1105. /* set default edge pos, will be overriden 1106. * in decode_header if needed */ 1107. s->h_edge_pos = s->mb_width * 16; ^ 1108. s->v_edge_pos = s->mb_height * 16; 1109. libavcodec/mpegvideo.c:1108:5: 1106. * in decode_header if needed */ 1107. s->h_edge_pos = s->mb_width * 16; 1108. s->v_edge_pos = s->mb_height * 16; ^ 1109. 1110. s->mb_num = s->mb_width * s->mb_height; libavcodec/mpegvideo.c:1110:5: 1108. s->v_edge_pos = s->mb_height * 16; 1109. 1110. s->mb_num = s->mb_width * s->mb_height; ^ 1111. 1112. s->block_wrap[0] = libavcodec/mpegvideo.c:1112:5: 1110. s->mb_num = s->mb_width * s->mb_height; 1111. 1112. s->block_wrap[0] = ^ 1113. s->block_wrap[1] = 1114. s->block_wrap[2] = libavcodec/mpegvideo.c:1116:5: 1114. s->block_wrap[2] = 1115. s->block_wrap[3] = s->b8_stride; 1116. s->block_wrap[4] = ^ 1117. s->block_wrap[5] = s->mb_stride; 1118. libavcodec/mpegvideo.c:1119:5: 1117. s->block_wrap[5] = s->mb_stride; 1118. 1119. y_size = s->b8_stride * (2 * s->mb_height + 1); ^ 1120. c_size = s->mb_stride * (s->mb_height + 1); 1121. yc_size = y_size + 2 * c_size; libavcodec/mpegvideo.c:1120:5: 1118. 1119. y_size = s->b8_stride * (2 * s->mb_height + 1); 1120. c_size = s->mb_stride * (s->mb_height + 1); ^ 1121. yc_size = y_size + 2 * c_size; 1122. libavcodec/mpegvideo.c:1121:5: 1119. y_size = s->b8_stride * (2 * s->mb_height + 1); 1120. c_size = s->mb_stride * (s->mb_height + 1); 1121. yc_size = y_size + 2 * c_size; ^ 1122. 1123. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), libavcodec/mpegvideo.c:1123:5: 1121. yc_size = y_size + 2 * c_size; 1122. 1123. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), ^ 1124. fail); // error ressilience code looks cleaner with this 1125. for (y = 0; y < s->mb_height; y++) libavutil/mem.c:205:1: start of procedure av_mallocz() 203. } 204. 205. void *av_mallocz(size_t size) ^ 206. { 207. void *ptr = av_malloc(size); libavutil/mem.c:207:5: 205. void *av_mallocz(size_t size) 206. { 207. void *ptr = av_malloc(size); ^ 208. if (ptr) 209. memset(ptr, 0, size); libavutil/mem.c:62:1: start of procedure av_malloc() 60. * linker will do it automatically. */ 61. 62. void *av_malloc(size_t size) ^ 63. { 64. void *ptr = NULL; libavutil/mem.c:64:5: 62. void *av_malloc(size_t size) 63. { 64. void *ptr = NULL; ^ 65. #if CONFIG_MEMALIGN_HACK 66. long diff; libavutil/mem.c:70:9: Taking true branch 68. 69. /* let's disallow possibly ambiguous cases */ 70. if (size > (INT_MAX - 32) || !size) ^ 71. return NULL; 72. libavutil/mem.c:71:9: 69. /* let's disallow possibly ambiguous cases */ 70. if (size > (INT_MAX - 32) || !size) 71. return NULL; ^ 72. 73. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavutil/mem.c:208:9: Taking false branch 206. { 207. void *ptr = av_malloc(size); 208. if (ptr) ^ 209. memset(ptr, 0, size); 210. return ptr; libavutil/mem.c:210:5: 208. if (ptr) 209. memset(ptr, 0, size); 210. return ptr; ^ 211. } 212. libavutil/mem.c:211:1: return from a call to av_mallocz 209. memset(ptr, 0, size); 210. return ptr; 211. } ^ 212. 213. char *av_strdup(const char *s) libavcodec/mpegvideo.c:1123:5: Taking true branch 1121. yc_size = y_size + 2 * c_size; 1122. 1123. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), ^ 1124. fail); // error ressilience code looks cleaner with this 1125. for (y = 0; y < s->mb_height; y++) libavcodec/mpegvideo.c:1123:5: Taking false branch 1121. yc_size = y_size + 2 * c_size; 1122. 1123. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), ^ 1124. fail); // error ressilience code looks cleaner with this 1125. for (y = 0; y < s->mb_height; y++) libavcodec/mpegvideo.c:1125:10: 1123. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), 1124. fail); // error ressilience code looks cleaner with this 1125. for (y = 0; y < s->mb_height; y++) ^ 1126. for (x = 0; x < s->mb_width; x++) 1127. s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride; libavcodec/mpegvideo.c:1125:17: Loop condition is false. Leaving loop 1123. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), 1124. fail); // error ressilience code looks cleaner with this 1125. for (y = 0; y < s->mb_height; y++) ^ 1126. for (x = 0; x < s->mb_width; x++) 1127. s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride; libavcodec/mpegvideo.c:1129:5: 1127. s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride; 1128. 1129. s->mb_index2xy[s->mb_height * s->mb_width] = ^ 1130. (s->mb_height - 1) * s->mb_stride + s->mb_width; // FIXME really needed? 1131.
https://github.com/libav/libav/blob/b16699f2da9c1d41eff852ec3a0c81f74fd44421/libavcodec/mpegvideo.c/#L1129
d2a_code_trace_data_45927
static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, OPENSSL_LH_DOALL_FUNC func, OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) { int i; OPENSSL_LH_NODE *a, *n; if (lh == NULL) return; for (i = lh->num_nodes - 1; i >= 0; i--) { a = lh->b[i]; while (a != NULL) { n = a->next; if (use_arg) func_arg(a->data, arg); else func(a->data); a = n; } } } test/sslapitest.c:5682: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 17 steps of the trace test/sslapitest.c:5673:10: Call 5671. verify_cb); 5672. 5673. if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, ^ 5674. NULL, NULL)) 5675. || !TEST_true(create_ssl_connection(serverssl, clientssl, test/ssltestlib.c:669:15: Call 667. if (*sssl != NULL) 668. serverssl = *sssl; 669. else if (!TEST_ptr(serverssl = SSL_new(serverctx))) ^ 670. goto error; 671. if (*cssl != NULL) ssl/ssl_lib.c:671:1: Parameter `ctx->sessions->num_nodes` 669. } 670. 671. > SSL *SSL_new(SSL_CTX *ctx) 672. { 673. SSL *s; test/sslapitest.c:5682:5: Call 5680. 5681. end: 5682. SSL_free(serverssl); ^ 5683. SSL_free(clientssl); 5684. SSL_CTX_free(sctx); ssl/ssl_lib.c:1133:1: Parameter `s->ctx->sessions->num_nodes` 1131. } 1132. 1133. > void SSL_free(SSL *s) 1134. { 1135. int i; ssl/ssl_lib.c:1206:5: Call 1204. RECORD_LAYER_release(&s->rlayer); 1205. 1206. SSL_CTX_free(s->ctx); ^ 1207. 1208. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:3078:1: Parameter `a->sessions->num_nodes` 3076. } 3077. 3078. > void SSL_CTX_free(SSL_CTX *a) 3079. { 3080. int i; ssl/ssl_lib.c:3104:9: Call 3102. */ 3103. if (a->sessions != NULL) 3104. SSL_CTX_flush_sessions(a, 0); ^ 3105. 3106. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:1106:1: Parameter `s->sessions->num_nodes` 1104. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1105. 1106. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 1107. { 1108. unsigned long i; ssl/ssl_sess.c:1119:5: Call 1117. i = lh_SSL_SESSION_get_down_load(s->sessions); 1118. lh_SSL_SESSION_set_down_load(s->sessions, 0); 1119. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 1120. lh_SSL_SESSION_set_down_load(s->sessions, i); 1121. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:1104:1: Parameter `lh->num_nodes` 1102. } 1103. 1104. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1105. 1106. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:1104:1: Call 1102. } 1103. 1104. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1105. 1106. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:209:1: Parameter `lh->num_nodes` 207. } 208. 209. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 210. { 211. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:211:5: Call 209. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 210. { 211. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 212. } 213. crypto/lhash/lhash.c:177:1: <LHS trace> 175. } 176. 177. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 178. OPENSSL_LH_DOALL_FUNC func, 179. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:177:1: Parameter `lh->num_nodes` 175. } 176. 177. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 178. OPENSSL_LH_DOALL_FUNC func, 179. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:191:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_free` 189. * memory leaks otherwise 190. */ 191. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 192. a = lh->b[i]; 193. while (a != NULL) {
https://github.com/openssl/openssl/blob/6e68dae85a8f91944370125561c7ec0d5da46c20/crypto/lhash/lhash.c/#L191
d2a_code_trace_data_45928
static void new_subtitle_stream(AVFormatContext *oc) { AVStream *st; AVCodecContext *subtitle_enc; st = av_new_stream(oc, streamid_map[oc->nb_streams]); if (!st) { fprintf(stderr, "Could not alloc stream\n"); ffmpeg_exit(1); } avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_SUBTITLE); bitstream_filters[nb_output_files][oc->nb_streams - 1]= subtitle_bitstream_filters; subtitle_bitstream_filters= NULL; subtitle_enc = st->codec; subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE; if(subtitle_codec_tag) subtitle_enc->codec_tag= subtitle_codec_tag; if (subtitle_stream_copy) { st->stream_copy = 1; } else { set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM); subtitle_enc->codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1, subtitle_enc->strict_std_compliance); output_codecs[nb_ocodecs] = avcodec_find_encoder_by_name(subtitle_codec_name); } nb_ocodecs++; if (subtitle_language) { av_metadata_set2(&st->metadata, "language", subtitle_language, 0); av_freep(&subtitle_language); } subtitle_disable = 0; av_freep(&subtitle_codec_name); subtitle_stream_copy = 0; } ffmpeg.c:3574: error: Null Dereference pointer `st` last assigned on line 3569 could be null and is dereferenced at line 3574, column 35. ffmpeg.c:3564:1: start of procedure new_subtitle_stream() 3562. } 3563. 3564. static void new_subtitle_stream(AVFormatContext *oc) ^ 3565. { 3566. AVStream *st; ffmpeg.c:3569:5: 3567. AVCodecContext *subtitle_enc; 3568. 3569. st = av_new_stream(oc, streamid_map[oc->nb_streams]); ^ 3570. if (!st) { 3571. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2501:1: start of procedure av_new_stream() 2499. } 2500. 2501. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2502. { 2503. AVStream *st; libavformat/utils.c:2506:9: Taking true branch 2504. int i; 2505. 2506. if (s->nb_streams >= MAX_STREAMS){ ^ 2507. av_log(s, AV_LOG_ERROR, "Too many streams\n"); 2508. return NULL; libavformat/utils.c:2507:9: Skipping av_log(): empty list of specs 2505. 2506. if (s->nb_streams >= MAX_STREAMS){ 2507. av_log(s, AV_LOG_ERROR, "Too many streams\n"); ^ 2508. return NULL; 2509. } libavformat/utils.c:2508:9: 2506. if (s->nb_streams >= MAX_STREAMS){ 2507. av_log(s, AV_LOG_ERROR, "Too many streams\n"); 2508. return NULL; ^ 2509. } 2510. libavformat/utils.c:2543:1: return from a call to av_new_stream 2541. s->streams[s->nb_streams++] = st; 2542. return st; 2543. } ^ 2544. 2545. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:3570:10: Taking true branch 3568. 3569. st = av_new_stream(oc, streamid_map[oc->nb_streams]); 3570. if (!st) { ^ 3571. fprintf(stderr, "Could not alloc stream\n"); 3572. ffmpeg_exit(1); ffmpeg.c:3571:9: 3569. st = av_new_stream(oc, streamid_map[oc->nb_streams]); 3570. if (!st) { 3571. fprintf(stderr, "Could not alloc stream\n"); ^ 3572. ffmpeg_exit(1); 3573. } ffmpeg.c:3572:9: Skipping ffmpeg_exit(): empty list of specs 3570. if (!st) { 3571. fprintf(stderr, "Could not alloc stream\n"); 3572. ffmpeg_exit(1); ^ 3573. } 3574. avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_SUBTITLE); ffmpeg.c:3574:5: 3572. ffmpeg_exit(1); 3573. } 3574. avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_SUBTITLE); ^ 3575. 3576. bitstream_filters[nb_output_files][oc->nb_streams - 1]= subtitle_bitstream_filters;
https://github.com/libav/libav/blob/ad0d70c964f852a18e9ab8124f0e7aa8876cac6e/ffmpeg.c/#L3574
d2a_code_trace_data_45929
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ec2_smpl.c:700: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end`. Showing all 9 steps of the trace crypto/ec/ec2_smpl.c:665:1: Parameter `ctx->stack.depth` 663. 664. /* Forces the given EC_POINT to internally use affine coordinates. */ 665. > int ec_GF2m_simple_make_affine(const EC_GROUP *group, EC_POINT *point, 666. BN_CTX *ctx) 667. { crypto/ec/ec2_smpl.c:681:5: Call 679. } 680. 681. BN_CTX_start(ctx); ^ 682. x = BN_CTX_get(ctx); 683. y = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/ec/ec2_smpl.c:700:5: Call 698. 699. err: 700. BN_CTX_end(ctx); ^ 701. BN_CTX_free(new_ctx); 702. return ret; crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <LHS trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/a8ea8018fa187e22fb4989450b550589e20f62c2/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_45930
int test_kron(BIO *bp, BN_CTX *ctx) { BN_GENCB cb; BIGNUM *a, *b, *r, *t; int i; int legendre, kronecker; int ret = 0; a = BN_new(); b = BN_new(); r = BN_new(); t = BN_new(); if (a == NULL || b == NULL || r == NULL || t == NULL) goto err; BN_GENCB_set(&cb, genprime_cb, NULL); if (!BN_generate_prime_ex(b, 512, 0, NULL, NULL, &cb)) goto err; b->neg = rand_neg(); putc('\n', stderr); for (i = 0; i < num0; i++) { if (!BN_bntest_rand(a, 512, 0, 0)) goto err; a->neg = rand_neg(); if (!BN_copy(t, b)) goto err; t->neg = 0; if (!BN_sub_word(t, 1)) goto err; if (!BN_rshift1(t, t)) goto err; b->neg = 0; if (!BN_mod_exp_recp(r, a, t, b, ctx)) goto err; b->neg = 1; if (BN_is_word(r, 1)) legendre = 1; else if (BN_is_zero(r)) legendre = 0; else { if (!BN_add_word(r, 1)) goto err; if (0 != BN_ucmp(r, b)) { fprintf(stderr, "Legendre symbol computation failed\n"); goto err; } legendre = -1; } kronecker = BN_kronecker(a, b, ctx); if (kronecker < -1) goto err; if (a->neg && b->neg) kronecker = -kronecker; if (legendre != kronecker) { fprintf(stderr, "legendre != kronecker; a = "); BN_print_fp(stderr, a); fprintf(stderr, ", b = "); BN_print_fp(stderr, b); fprintf(stderr, "\n"); goto err; } putc('.', stderr); fflush(stderr); } putc('\n', stderr); fflush(stderr); ret = 1; err: BN_free(a); BN_free(b); BN_free(r); BN_free(t); return ret; } test/bntest.c:1745: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1663, column 9 is not reachable after line 1745, column 5. Showing all 142 steps of the trace test/bntest.c:1653:1: start of procedure test_kron() 1651. } 1652. 1653. > int test_kron(BIO *bp, BN_CTX *ctx) 1654. { 1655. BN_GENCB cb; test/bntest.c:1659:5: 1657. int i; 1658. int legendre, kronecker; 1659. > int ret = 0; 1660. 1661. a = BN_new(); test/bntest.c:1661:5: 1659. int ret = 0; 1660. 1661. > a = BN_new(); 1662. b = BN_new(); 1663. r = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1662:5: 1660. 1661. a = BN_new(); 1662. > b = BN_new(); 1663. r = BN_new(); 1664. t = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1663:5: 1661. a = BN_new(); 1662. b = BN_new(); 1663. > r = BN_new(); 1664. t = BN_new(); 1665. if (a == NULL || b == NULL || r == NULL || t == NULL) crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1664:5: 1662. b = BN_new(); 1663. r = BN_new(); 1664. > t = BN_new(); 1665. if (a == NULL || b == NULL || r == NULL || t == NULL) 1666. goto err; crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1665:9: Taking false branch 1663. r = BN_new(); 1664. t = BN_new(); 1665. if (a == NULL || b == NULL || r == NULL || t == NULL) ^ 1666. goto err; 1667. test/bntest.c:1665:22: Taking false branch 1663. r = BN_new(); 1664. t = BN_new(); 1665. if (a == NULL || b == NULL || r == NULL || t == NULL) ^ 1666. goto err; 1667. test/bntest.c:1665:35: Taking false branch 1663. r = BN_new(); 1664. t = BN_new(); 1665. if (a == NULL || b == NULL || r == NULL || t == NULL) ^ 1666. goto err; 1667. test/bntest.c:1665:48: Taking false branch 1663. r = BN_new(); 1664. t = BN_new(); 1665. if (a == NULL || b == NULL || r == NULL || t == NULL) ^ 1666. goto err; 1667. test/bntest.c:1668:5: 1666. goto err; 1667. 1668. > BN_GENCB_set(&cb, genprime_cb, NULL); 1669. 1670. /* crypto/bn/bn_lib.c:981:1: start of procedure BN_GENCB_set() 979. 980. /* Populate a BN_GENCB structure with a "new"-style callback */ 981. > void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *), 982. void *cb_arg) 983. { crypto/bn/bn_lib.c:984:5: 982. void *cb_arg) 983. { 984. > BN_GENCB *tmp_gencb = gencb; 985. tmp_gencb->ver = 2; 986. tmp_gencb->arg = cb_arg; crypto/bn/bn_lib.c:985:5: 983. { 984. BN_GENCB *tmp_gencb = gencb; 985. > tmp_gencb->ver = 2; 986. tmp_gencb->arg = cb_arg; 987. tmp_gencb->cb.cb_2 = callback; crypto/bn/bn_lib.c:986:5: 984. BN_GENCB *tmp_gencb = gencb; 985. tmp_gencb->ver = 2; 986. > tmp_gencb->arg = cb_arg; 987. tmp_gencb->cb.cb_2 = callback; 988. } crypto/bn/bn_lib.c:987:5: 985. tmp_gencb->ver = 2; 986. tmp_gencb->arg = cb_arg; 987. > tmp_gencb->cb.cb_2 = callback; 988. } 989. crypto/bn/bn_lib.c:988:1: return from a call to BN_GENCB_set 986. tmp_gencb->arg = cb_arg; 987. tmp_gencb->cb.cb_2 = callback; 988. > } 989. 990. void *BN_GENCB_get_arg(BN_GENCB *cb) test/bntest.c:1680:10: Taking true branch 1678. */ 1679. 1680. if (!BN_generate_prime_ex(b, 512, 0, NULL, NULL, &cb)) ^ 1681. goto err; 1682. b->neg = rand_neg(); test/bntest.c:1742:2: 1740. fflush(stderr); 1741. ret = 1; 1742. > err: 1743. BN_free(a); 1744. BN_free(b); test/bntest.c:1743:5: 1741. ret = 1; 1742. err: 1743. > BN_free(a); 1744. BN_free(b); 1745. BN_free(r); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a) test/bntest.c:1744:5: 1742. err: 1743. BN_free(a); 1744. > BN_free(b); 1745. BN_free(r); 1746. BN_free(t); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a) test/bntest.c:1745:5: 1743. BN_free(a); 1744. BN_free(b); 1745. > BN_free(r); 1746. BN_free(t); 1747. return ret; crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L1745
d2a_code_trace_data_45931
static void BN_POOL_release(BN_POOL *p, unsigned int num) { unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; p->used -= num; while (num--) { bn_check_top(p->current->vals + offset); if (offset == 0) { offset = BN_CTX_POOL_SIZE - 1; p->current = p->current->prev; } else offset--; } } crypto/rsa/rsa_sp800_56b_check.c:67: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end`. Showing all 9 steps of the trace crypto/rsa/rsa_sp800_56b_check.c:57:14: Call 55. && (BN_cmp(rsa->iqmp, rsa->p) < 0) 56. /* (d) 1 = (dP . e) mod (p - 1)*/ 57. && BN_mod_mul(r, rsa->dmp1, rsa->e, p1, ctx) ^ 58. && BN_is_one(r) 59. /* (e) 1 = (dQ . e) mod (q - 1) */ crypto/bn/bn_mod.c:218:5: Call 216. ret = 1; 217. err: 218. BN_CTX_end(ctx); ^ 219. return ret; 220. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->pool.used` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/rsa/rsa_sp800_56b_check.c:67:5: Call 65. BN_clear(p1); 66. BN_clear(q1); 67. BN_CTX_end(ctx); ^ 68. return ret; 69. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->pool.used` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:194:13: Call 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) 194. BN_POOL_release(&ctx->pool, ctx->used - fp); ^ 195. ctx->used = fp; 196. /* Unjam "too_many" in case "get" had failed */ crypto/bn/bn_ctx.c:338:1: <LHS trace> 336. } 337. 338. > static void BN_POOL_release(BN_POOL *p, unsigned int num) 339. { 340. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; crypto/bn/bn_ctx.c:338:1: Parameter `p->used` 336. } 337. 338. > static void BN_POOL_release(BN_POOL *p, unsigned int num) 339. { 340. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; crypto/bn/bn_ctx.c:340:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end` 338. static void BN_POOL_release(BN_POOL *p, unsigned int num) 339. { 340. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; ^ 341. 342. p->used -= num;
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L340
d2a_code_trace_data_45932
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return 0; r->neg = a->neg; lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return 1; } crypto/dsa/dsa_ossl.c:184: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_generate_dsa_nonce`. Showing all 22 steps of the trace crypto/dsa/dsa_ossl.c:187:21: Call 185. dlen, ctx)) 186. goto err; 187. } else if (!BN_priv_rand_range(k, dsa->q)) ^ 188. goto err; 189. } while (BN_is_zero(k)); crypto/bn/bn_rand.c:184:12: Call 182. int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range) 183. { 184. return bnrand_range(PRIVATE, r, range); ^ 185. } 186. crypto/bn/bn_rand.c:113:1: Parameter `range->top` 111. 112. /* random number r: 0 <= r < range */ 113. > static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range) 114. { 115. int n; crypto/dsa/dsa_ossl.c:184:18: Call 182. * This protects the private key from a weak PRNG. 183. */ 184. if (!BN_generate_dsa_nonce(k, dsa->q, dsa->priv_key, dgst, ^ 185. dlen, ctx)) 186. goto err; crypto/bn/bn_rand.c:205:1: Parameter `range->top` 203. * used. 204. */ 205. > int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range, 206. const BIGNUM *priv, const unsigned char *message, 207. size_t message_len, BN_CTX *ctx) crypto/bn/bn_rand.c:218:34: Call 216. unsigned done, todo; 217. /* We generate |range|+8 bytes of random output. */ 218. const unsigned num_k_bytes = BN_num_bytes(range) + 8; ^ 219. unsigned char private_bytes[96]; 220. unsigned char *k_bytes; crypto/bn/bn_lib.c:139:9: Call 137. bn_check_top(a); 138. 139. if (BN_is_zero(a)) ^ 140. return 0; 141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); crypto/bn/bn_lib.c:814:1: Parameter `a->top` 812. } 813. 814. > int BN_is_zero(const BIGNUM *a) 815. { 816. return a->top == 0; crypto/bn/bn_rand.c:260:9: Call 258. if (!BN_bin2bn(k_bytes, num_k_bytes, out)) 259. goto err; 260. if (BN_mod(out, out, range, ctx) != 1) ^ 261. goto err; 262. ret = 1; crypto/bn/bn_div.c:199:31: Call 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_lib.c:140:9: Assignment 138. 139. if (BN_is_zero(a)) 140. return 0; ^ 141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 142. } crypto/bn/bn_div.c:199:5: Assignment 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_div.c:200:11: Call 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) ^ 201. goto err; 202. sdiv->neg = 0; crypto/bn/bn_shift.c:83:1: <Offset trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `n` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:5: Assignment 95. } 96. 97. nw = n / BN_BITS2; ^ 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) 99. return 0; crypto/bn/bn_shift.c:83:1: <Length trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `*r->d` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:98:9: Call 96. 97. nw = n / BN_BITS2; 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 99. return 0; 100. r->neg = a->neg; crypto/bn/bn_lib.c:910:1: Parameter `*a->d` 908. } 909. 910. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 911. { 912. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:104:5: Assignment 102. rb = BN_BITS2 - lb; 103. f = a->d; 104. t = r->d; ^ 105. t[a->top + nw] = 0; 106. if (lb == 0) crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_generate_dsa_nonce` 110. for (i = a->top - 1; i >= 0; i--) { 111. l = f[i]; 112. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 113. t[nw + i] = (l << lb) & BN_MASK2; 114. }
https://github.com/openssl/openssl/blob/49cd47eaababc8c57871b929080fc1357e2ad7b8/crypto/bn/bn_shift.c/#L112
d2a_code_trace_data_45933
static int opt_vstats(const char *opt, const char *arg) { char filename[40]; time_t today2 = time(NULL); struct tm *today = localtime(&today2); snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, today->tm_sec); return opt_vstats_file(opt, filename); } ffmpeg.c:4200: error: Null Dereference pointer `today` last assigned on line 4198 could be null and is dereferenced at line 4200, column 69. ffmpeg.c:4194:1: start of procedure opt_vstats() 4192. } 4193. 4194. static int opt_vstats(const char *opt, const char *arg) ^ 4195. { 4196. char filename[40]; ffmpeg.c:4197:5: 4195. { 4196. char filename[40]; 4197. time_t today2 = time(NULL); ^ 4198. struct tm *today = localtime(&today2); 4199. ffmpeg.c:4198:5: 4196. char filename[40]; 4197. time_t today2 = time(NULL); 4198. struct tm *today = localtime(&today2); ^ 4199. 4200. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, ffmpeg.c:4200:5: 4198. struct tm *today = localtime(&today2); 4199. 4200. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, ^ 4201. today->tm_sec); 4202. return opt_vstats_file(opt, filename);
https://github.com/libav/libav/blob/a6286bda0956bfe15b4e1a9f96e1689666e1d866/ffmpeg.c/#L4200
d2a_code_trace_data_45934
void ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec, size_t md_size) { #if defined(CBC_MAC_ROTATE_IN_PLACE) unsigned char rotated_mac_buf[64 + EVP_MAX_MD_SIZE]; unsigned char *rotated_mac; #else unsigned char rotated_mac[EVP_MAX_MD_SIZE]; #endif size_t mac_end = rec->length; size_t mac_start = mac_end - md_size; size_t scan_start = 0; size_t i, j; size_t div_spoiler; size_t rotate_offset; OPENSSL_assert(rec->orig_len >= md_size); OPENSSL_assert(md_size <= EVP_MAX_MD_SIZE); #if defined(CBC_MAC_ROTATE_IN_PLACE) rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) & 63); #endif if (rec->orig_len > md_size + 255 + 1) scan_start = rec->orig_len - (md_size + 255 + 1); div_spoiler = md_size >> 1; div_spoiler <<= (sizeof(div_spoiler) - 1) * 8; rotate_offset = (div_spoiler + mac_start - scan_start) % md_size; memset(rotated_mac, 0, md_size); for (i = scan_start, j = 0; i < rec->orig_len; i++) { unsigned char mac_started = constant_time_ge_8_s(i, mac_start); unsigned char mac_ended = constant_time_ge_8_s(i, mac_end); unsigned char b = rec->data[i]; rotated_mac[j++] |= b & mac_started & ~mac_ended; j &= constant_time_lt_s(j, md_size); } #if defined(CBC_MAC_ROTATE_IN_PLACE) j = 0; for (i = 0; i < md_size; i++) { ((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32]; out[j++] = rotated_mac[rotate_offset++]; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #else memset(out, 0, md_size); rotate_offset = md_size - rotate_offset; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); for (i = 0; i < md_size; i++) { for (j = 0; j < md_size; j++) out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset); rotate_offset++; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #endif } ssl/record/ssl3_record.c:437: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [256, 320]):unsigned64 by call to `ssl3_cbc_copy_mac`. Showing all 8 steps of the trace ssl/record/ssl3_record.c:125:1: Parameter `s->rlayer.rrec.length` 123. */ 124. /* used only by ssl3_read_bytes */ 125. > int ssl3_get_record(SSL *s) 126. { 127. int ssl_major, ssl_minor, al; ssl/record/ssl3_record.c:329:9: Assignment 327. /* decrypt in place in 'rr->input' */ 328. rr[num_recs].data = rr[num_recs].input; 329. rr[num_recs].orig_len = rr[num_recs].length; ^ 330. 331. /* Mark this record as not read by upper layers yet */ ssl/record/ssl3_record.c:437:17: Call 435. */ 436. mac = mac_tmp; 437. ssl3_cbc_copy_mac(mac_tmp, &rr[j], mac_size); ^ 438. rr[j].length -= mac_size; 439. } else { ssl/record/ssl3_record.c:1231:1: <LHS trace> 1229. #define CBC_MAC_ROTATE_IN_PLACE 1230. 1231. > void ssl3_cbc_copy_mac(unsigned char *out, 1232. const SSL3_RECORD *rec, size_t md_size) 1233. { ssl/record/ssl3_record.c:1231:1: Parameter `md_size` 1229. #define CBC_MAC_ROTATE_IN_PLACE 1230. 1231. > void ssl3_cbc_copy_mac(unsigned char *out, 1232. const SSL3_RECORD *rec, size_t md_size) 1233. { ssl/record/ssl3_record.c:1231:1: <RHS trace> 1229. #define CBC_MAC_ROTATE_IN_PLACE 1230. 1231. > void ssl3_cbc_copy_mac(unsigned char *out, 1232. const SSL3_RECORD *rec, size_t md_size) 1233. { ssl/record/ssl3_record.c:1231:1: Parameter `md_size` 1229. #define CBC_MAC_ROTATE_IN_PLACE 1230. 1231. > void ssl3_cbc_copy_mac(unsigned char *out, 1232. const SSL3_RECORD *rec, size_t md_size) 1233. { ssl/record/ssl3_record.c:1264:9: Binary operation: ([0, +oo] - [256, 320]):unsigned64 by call to `ssl3_cbc_copy_mac` 1262. /* This information is public so it's safe to branch based on it. */ 1263. if (rec->orig_len > md_size + 255 + 1) 1264. scan_start = rec->orig_len - (md_size + 255 + 1); ^ 1265. /* 1266. * div_spoiler contains a multiple of md_size that is used to cause the
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/record/ssl3_record.c/#L1264
d2a_code_trace_data_45935
static void mpegts_write_pes(AVFormatContext *s, AVStream *st, const uint8_t *payload, int payload_size, int64_t pts, int64_t dts) { MpegTSWriteStream *ts_st = st->priv_data; uint8_t buf[TS_PACKET_SIZE]; uint8_t *q; int val, is_start, len, header_len, write_pcr, private_code, flags; int afc_len, stuffing_len; int64_t pcr = -1; is_start = 1; while (payload_size > 0) { retransmit_si_info(s); write_pcr = 0; if (ts_st->pid == ts_st->service->pcr_pid) { ts_st->service->pcr_packet_count++; if (ts_st->service->pcr_packet_count >= ts_st->service->pcr_packet_freq) { ts_st->service->pcr_packet_count = 0; write_pcr = 1; pcr = pts; } } q = buf; *q++ = 0x47; val = (ts_st->pid >> 8); if (is_start) val |= 0x40; *q++ = val; *q++ = ts_st->pid; *q++ = 0x10 | ts_st->cc | (write_pcr ? 0x20 : 0); ts_st->cc = (ts_st->cc + 1) & 0xf; if (write_pcr) { *q++ = 7; *q++ = 0x10; *q++ = pcr >> 25; *q++ = pcr >> 17; *q++ = pcr >> 9; *q++ = pcr >> 1; *q++ = (pcr & 1) << 7; *q++ = 0; } if (is_start) { *q++ = 0x00; *q++ = 0x00; *q++ = 0x01; private_code = 0; if (st->codec->codec_type == CODEC_TYPE_VIDEO) { *q++ = 0xe0; } else if (st->codec->codec_type == CODEC_TYPE_AUDIO && (st->codec->codec_id == CODEC_ID_MP2 || st->codec->codec_id == CODEC_ID_MP3)) { *q++ = 0xc0; } else { *q++ = 0xbd; if (st->codec->codec_type == CODEC_TYPE_SUBTITLE) { private_code = 0x20; } } header_len = 0; flags = 0; if (pts != AV_NOPTS_VALUE) { header_len += 5; flags |= 0x80; } if (dts != AV_NOPTS_VALUE) { header_len += 5; flags |= 0x40; } len = payload_size + header_len + 3; if (private_code != 0) len++; *q++ = len >> 8; *q++ = len; val = 0x80; if (st->codec->codec_type == CODEC_TYPE_SUBTITLE) val |= 0x04; *q++ = val; *q++ = flags; *q++ = header_len; if (pts != AV_NOPTS_VALUE) { write_pts(q, flags >> 6, pts); q += 5; } if (dts != AV_NOPTS_VALUE) { write_pts(q, 1, dts); q += 5; } if (private_code != 0) *q++ = private_code; is_start = 0; } header_len = q - buf; len = TS_PACKET_SIZE - header_len; if (len > payload_size) len = payload_size; stuffing_len = TS_PACKET_SIZE - header_len - len; if (stuffing_len > 0) { if (buf[3] & 0x20) { afc_len = buf[4] + 1; memmove(buf + 4 + afc_len + stuffing_len, buf + 4 + afc_len, header_len - (4 + afc_len)); buf[4] += stuffing_len; memset(buf + 4 + afc_len, 0xff, stuffing_len); } else { memmove(buf + 4 + stuffing_len, buf + 4, header_len - 4); buf[3] |= 0x20; buf[4] = stuffing_len - 1; if (stuffing_len >= 2) { buf[5] = 0x00; memset(buf + 6, 0xff, stuffing_len - 2); } } } memcpy(buf + TS_PACKET_SIZE - len, payload, len); payload += len; payload_size -= len; put_buffer(s->pb, buf, TS_PACKET_SIZE); } put_flush_packet(s->pb); } libavformat/mpegtsenc.c:667: error: Buffer Overrun L2 Offset added: [5, 371] (⇐ [4, 187] + [1, 184]) Size: 188 by call to `mpegts_write_pes`. libavformat/mpegtsenc.c:667:13: Call 665. ts_st = st->priv_data; 666. if (ts_st->payload_index > 0) { 667. mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_index, ^ 668. ts_st->payload_pts, ts_st->payload_dts); 669. } libavformat/mpegtsenc.c:480:1: Parameter `st->priv_data->pid` 478. 479. /* NOTE: pes_data contains all the PES packet */ 480. static void mpegts_write_pes(AVFormatContext *s, AVStream *st, ^ 481. const uint8_t *payload, int payload_size, 482. int64_t pts, int64_t dts) libavformat/mpegtsenc.c:667:13: Call 665. ts_st = st->priv_data; 666. if (ts_st->payload_index > 0) { 667. mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_index, ^ 668. ts_st->payload_pts, ts_st->payload_dts); 669. } libavformat/mpegtsenc.c:480:1: <Offset trace> 478. 479. /* NOTE: pes_data contains all the PES packet */ 480. static void mpegts_write_pes(AVFormatContext *s, AVStream *st, ^ 481. const uint8_t *payload, int payload_size, 482. int64_t pts, int64_t dts) libavformat/mpegtsenc.c:480:1: Parameter `payload_size` 478. 479. /* NOTE: pes_data contains all the PES packet */ 480. static void mpegts_write_pes(AVFormatContext *s, AVStream *st, ^ 481. const uint8_t *payload, int payload_size, 482. int64_t pts, int64_t dts) libavformat/mpegtsenc.c:480:1: <Length trace> 478. 479. /* NOTE: pes_data contains all the PES packet */ 480. static void mpegts_write_pes(AVFormatContext *s, AVStream *st, ^ 481. const uint8_t *payload, int payload_size, 482. int64_t pts, int64_t dts) libavformat/mpegtsenc.c:480:1: Array declaration 478. 479. /* NOTE: pes_data contains all the PES packet */ 480. static void mpegts_write_pes(AVFormatContext *s, AVStream *st, ^ 481. const uint8_t *payload, int payload_size, 482. int64_t pts, int64_t dts) libavformat/mpegtsenc.c:608:9: Array access: Offset added: [5, 371] (⇐ [4, 187] + [1, 184]) Size: 188 by call to `mpegts_write_pes` 606. } 607. } 608. memcpy(buf + TS_PACKET_SIZE - len, payload, len); ^ 609. payload += len; 610. payload_size -= len;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/mpegtsenc.c/#L608
d2a_code_trace_data_45936
static int sab_diamond_search(MpegEncContext * s, int *best, int dmin, int src_index, int ref_index, int const penalty_factor, int size, int h, int flags) { MotionEstContext * const c= &s->me; me_cmp_func cmpf, chroma_cmpf; Minima minima[MAX_SAB_SIZE]; const int minima_count= FFABS(c->dia_size); int i, j; LOAD_COMMON LOAD_COMMON2 int map_generation= c->map_generation; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; for(j=i=0; i<ME_MAP_SIZE && j<MAX_SAB_SIZE; i++){ uint32_t key= map[i]; key += (1<<(ME_MAP_MV_BITS-1)) + (1<<(2*ME_MAP_MV_BITS-1)); if((key&((-1)<<(2*ME_MAP_MV_BITS))) != map_generation) continue; minima[j].height= score_map[i]; minima[j].x= key & ((1<<ME_MAP_MV_BITS)-1); key>>=ME_MAP_MV_BITS; minima[j].y= key & ((1<<ME_MAP_MV_BITS)-1); minima[j].x-= (1<<(ME_MAP_MV_BITS-1)); minima[j].y-= (1<<(ME_MAP_MV_BITS-1)); if( minima[j].x > xmax || minima[j].x < xmin || minima[j].y > ymax || minima[j].y < ymin) continue; minima[j].checked=0; if(minima[j].x || minima[j].y) minima[j].height+= (mv_penalty[((minima[j].x)<<shift)-pred_x] + mv_penalty[((minima[j].y)<<shift)-pred_y])*penalty_factor; j++; } qsort(minima, j, sizeof(Minima), minima_cmp); for(; j<minima_count; j++){ minima[j].height=256*256*256*64; minima[j].checked=0; minima[j].x= minima[j].y=0; } for(i=0; i<minima_count; i++){ const int x= minima[i].x; const int y= minima[i].y; int d; if(minima[i].checked) continue; if( x >= xmax || x <= xmin || y >= ymax || y <= ymin) continue; SAB_CHECK_MV(x-1, y) SAB_CHECK_MV(x+1, y) SAB_CHECK_MV(x , y-1) SAB_CHECK_MV(x , y+1) minima[i].checked= 1; } best[0]= minima[0].x; best[1]= minima[0].y; dmin= minima[0].height; if( best[0] < xmax && best[0] > xmin && best[1] < ymax && best[1] > ymin){ int d; CHECK_MV(best[0]-1, best[1]) CHECK_MV(best[0]+1, best[1]) CHECK_MV(best[0], best[1]-1) CHECK_MV(best[0], best[1]+1) } return dmin; } libavcodec/motion_est_template.c:869: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:869:15: 867. 868. if( x >= xmax || x <= xmin 869. || y >= ymax || y <= ymin) ^ 870. continue; 871.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L869
d2a_code_trace_data_45937
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } r->neg = a->neg; nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return (0); lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return (1); } ssl/statem/statem_srvr.c:2379: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `srp_generate_server_master_secret`. Showing all 22 steps of the trace ssl/statem/statem_srvr.c:2361:29: Call 2359. goto f_err; 2360. } 2361. if ((s->srp_ctx.A = BN_bin2bn(data, i, NULL)) == NULL) { ^ 2362. SSLerr(SSL_F_TLS_PROCESS_CLIENT_KEY_EXCHANGE, ERR_R_BN_LIB); 2363. goto err; crypto/bn/bn_lib.c:492:9: Assignment 490. n = len; 491. if (n == 0) { 492. ret->top = 0; ^ 493. return (ret); 494. } ssl/statem/statem_srvr.c:2379:14: Call 2377. } 2378. 2379. if (!srp_generate_server_master_secret(s)) { ^ 2380. SSLerr(SSL_F_TLS_PROCESS_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); 2381. goto err; ssl/tls_srp.c:284:1: Parameter `s->srp_ctx.A->top` 282. } 283. 284. > int srp_generate_server_master_secret(SSL *s) 285. { 286. BIGNUM *K = NULL, *u = NULL; ssl/tls_srp.c:290:10: Call 288. unsigned char *tmp = NULL; 289. 290. if (!SRP_Verify_A_mod_N(s->srp_ctx.A, s->srp_ctx.N)) ^ 291. goto err; 292. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL) crypto/srp/srp_lib.c:274:1: Parameter `A->top` 272. } 273. 274. > int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N) 275. { 276. /* Checks if A % N == 0 */ crypto/srp/srp_lib.c:277:12: Call 275. { 276. /* Checks if A % N == 0 */ 277. return SRP_Verify_B_mod_N(A, N); ^ 278. } 279. crypto/srp/srp_lib.c:253:1: Parameter `B->top` 251. } 252. 253. > int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N) 254. { 255. BIGNUM *r; crypto/srp/srp_lib.c:265:10: Call 263. goto err; 264. /* Checks if B % N == 0 */ 265. if (!BN_nnmod(r, B, N, bn_ctx)) ^ 266. goto err; 267. ret = !BN_is_zero(r); crypto/bn/bn_mod.c:13:1: Parameter `m->top` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:140:1: Parameter `num->top` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { crypto/bn/bn_div.c:210:11: Call 208. sdiv->neg = 0; 209. norm_shift += BN_BITS2; 210. if (!(BN_lshift(snum, num, norm_shift))) ^ 211. goto err; 212. snum->neg = 0; crypto/bn/bn_shift.c:81:1: <Offset trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `n` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:96:5: Assignment 94. 95. r->neg = a->neg; 96. nw = n / BN_BITS2; ^ 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) 98. return (0); crypto/bn/bn_shift.c:81:1: <Length trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `*r->d` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:9: Call 95. r->neg = a->neg; 96. nw = n / BN_BITS2; 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 98. return (0); 99. lb = n % BN_BITS2; crypto/bn/bn_lib.c:1016:1: Parameter `*a->d` 1014. } 1015. 1016. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 1017. { 1018. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:102:5: Assignment 100. rb = BN_BITS2 - lb; 101. f = a->d; 102. t = r->d; ^ 103. t[a->top + nw] = 0; 104. if (lb == 0) crypto/bn/bn_shift.c:110:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `srp_generate_server_master_secret` 108. for (i = a->top - 1; i >= 0; i--) { 109. l = f[i]; 110. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 111. t[nw + i] = (l << lb) & BN_MASK2; 112. }
https://github.com/openssl/openssl/blob/4973a60cb92dc121fc09246bff3815afc0f8ab9a/crypto/bn/bn_shift.c/#L110
d2a_code_trace_data_45938
void ff_MPV_frame_end(MpegEncContext *s) { int i; if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { ff_xvmc_field_end(s); } else if ((s->er.error_count || s->encoding) && !s->avctx->hwaccel && s->unrestricted_mv && s->current_picture.reference && !s->intra_only && !(s->flags & CODEC_FLAG_EMU_EDGE)) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); int hshift = desc->log2_chroma_w; int vshift = desc->log2_chroma_h; s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize, s->h_edge_pos, s->v_edge_pos, EDGE_WIDTH, EDGE_WIDTH, EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.f.data[1], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.f.data[2], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); } emms_c(); s->last_pict_type = s->pict_type; s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f.quality; if (s->pict_type!= AV_PICTURE_TYPE_B) { s->last_non_b_pict_type = s->pict_type; } #if 0 for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (s->picture[i].f.data[0] == s->current_picture.f.data[0]) { s->picture[i] = s->current_picture; break; } } assert(i < MAX_PICTURE_COUNT); #endif if (s->encoding) { for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (!s->picture[i].reference) ff_mpeg_unref_picture(s, &s->picture[i]); } } #if 0 memset(&s->last_picture, 0, sizeof(Picture)); memset(&s->next_picture, 0, sizeof(Picture)); memset(&s->current_picture, 0, sizeof(Picture)); #endif s->avctx->coded_frame = &s->current_picture_ptr->f; if (s->current_picture.reference) ff_thread_report_progress(&s->current_picture_ptr->tf, INT_MAX, 0); } libavcodec/mpegvideo.c:1696: error: Null Dereference pointer `desc` last assigned on line 1695 could be null and is dereferenced at line 1696, column 21. libavcodec/mpegvideo.c:1682:1: start of procedure ff_MPV_frame_end() 1680. /* generic function for encode/decode called after a 1681. * frame has been coded/decoded. */ 1682. void ff_MPV_frame_end(MpegEncContext *s) ^ 1683. { 1684. int i; libavcodec/mpegvideo.c:1687:9: Taking false branch 1685. /* redraw edges for the frame if decoding didn't complete */ 1686. // just to make sure that all data is rendered. 1687. if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { ^ 1688. ff_xvmc_field_end(s); 1689. } else if ((s->er.error_count || s->encoding) && libavcodec/mpegvideo.c:1689:16: Taking false branch 1687. if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { 1688. ff_xvmc_field_end(s); 1689. } else if ((s->er.error_count || s->encoding) && ^ 1690. !s->avctx->hwaccel && 1691. s->unrestricted_mv && libavcodec/mpegvideo.c:1689:37: Taking true branch 1687. if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { 1688. ff_xvmc_field_end(s); 1689. } else if ((s->er.error_count || s->encoding) && ^ 1690. !s->avctx->hwaccel && 1691. s->unrestricted_mv && libavcodec/mpegvideo.c:1690:16: Taking true branch 1688. ff_xvmc_field_end(s); 1689. } else if ((s->er.error_count || s->encoding) && 1690. !s->avctx->hwaccel && ^ 1691. s->unrestricted_mv && 1692. s->current_picture.reference && libavcodec/mpegvideo.c:1691:15: Taking true branch 1689. } else if ((s->er.error_count || s->encoding) && 1690. !s->avctx->hwaccel && 1691. s->unrestricted_mv && ^ 1692. s->current_picture.reference && 1693. !s->intra_only && libavcodec/mpegvideo.c:1692:15: Taking true branch 1690. !s->avctx->hwaccel && 1691. s->unrestricted_mv && 1692. s->current_picture.reference && ^ 1693. !s->intra_only && 1694. !(s->flags & CODEC_FLAG_EMU_EDGE)) { libavcodec/mpegvideo.c:1693:16: Taking true branch 1691. s->unrestricted_mv && 1692. s->current_picture.reference && 1693. !s->intra_only && ^ 1694. !(s->flags & CODEC_FLAG_EMU_EDGE)) { 1695. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); libavcodec/mpegvideo.c:1694:17: Taking true branch 1692. s->current_picture.reference && 1693. !s->intra_only && 1694. !(s->flags & CODEC_FLAG_EMU_EDGE)) { ^ 1695. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 1696. int hshift = desc->log2_chroma_w; libavcodec/mpegvideo.c:1695:8: 1693. !s->intra_only && 1694. !(s->flags & CODEC_FLAG_EMU_EDGE)) { 1695. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); ^ 1696. int hshift = desc->log2_chroma_w; 1697. int vshift = desc->log2_chroma_h; libavutil/pixdesc.c:1468:1: start of procedure av_pix_fmt_desc_get() 1466. } 1467. 1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1470:9: Taking false branch 1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1471. return NULL; 1472. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1470:24: Taking true branch 1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1471. return NULL; 1472. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1471:9: 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1471. return NULL; ^ 1472. return &av_pix_fmt_descriptors[pix_fmt]; 1473. } libavutil/pixdesc.c:1473:1: return from a call to av_pix_fmt_desc_get 1471. return NULL; 1472. return &av_pix_fmt_descriptors[pix_fmt]; 1473. } ^ 1474. 1475. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libavcodec/mpegvideo.c:1696:8: 1694. !(s->flags & CODEC_FLAG_EMU_EDGE)) { 1695. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 1696. int hshift = desc->log2_chroma_w; ^ 1697. int vshift = desc->log2_chroma_h; 1698. s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize,
https://github.com/libav/libav/blob/2852740e23f91d6775714d7cc29b9a73e1111ce0/libavcodec/mpegvideo.c/#L1696
d2a_code_trace_data_45939
static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) { return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); } ssl/record/ssl3_record.c:1628: error: INTEGER_OVERFLOW_L2 ([1, +oo] - [0, 64]):unsigned64 by call to `ssl3_cbc_copy_mac`. Showing all 10 steps of the trace ssl/record/ssl3_record.c:1495:1: Parameter `s->rlayer.rrec.length` 1493. } 1494. 1495. > int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap) 1496. { 1497. int i, al; ssl/record/ssl3_record.c:1535:5: Assignment 1533. /* decrypt in place in 'rr->input' */ 1534. rr->data = rr->input; 1535. rr->orig_len = rr->length; ^ 1536. 1537. if (SSL_READ_ETM(s) && s->read_hash) { ssl/record/ssl3_record.c:1628:18: Call 1626. */ 1627. mac = mac_tmp; 1628. if (!ssl3_cbc_copy_mac(mac_tmp, rr, mac_size)) { ^ 1629. al = SSL_AD_INTERNAL_ERROR; 1630. SSLerr(SSL_F_DTLS1_PROCESS_RECORD, ERR_R_INTERNAL_ERROR); ssl/record/ssl3_record.c:1420:1: Parameter `md_size` 1418. #define CBC_MAC_ROTATE_IN_PLACE 1419. 1420. > int ssl3_cbc_copy_mac(unsigned char *out, 1421. const SSL3_RECORD *rec, size_t md_size) 1422. { ssl/record/ssl3_record.c:1468:14: Call 1466. rotate_offset |= j & mac_started; 1467. rotated_mac[j++] |= b & in_mac; 1468. j &= constant_time_lt_s(j, md_size); ^ 1469. } 1470. include/internal/constant_time_locl.h:117:1: <LHS trace> 115. } 116. 117. > static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 118. { 119. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); include/internal/constant_time_locl.h:117:1: Parameter `a` 115. } 116. 117. > static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 118. { 119. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); include/internal/constant_time_locl.h:117:1: <RHS trace> 115. } 116. 117. > static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 118. { 119. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); include/internal/constant_time_locl.h:117:1: Parameter `b` 115. } 116. 117. > static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 118. { 119. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); include/internal/constant_time_locl.h:119:12: Binary operation: ([1, +oo] - [0, 64]):unsigned64 by call to `ssl3_cbc_copy_mac` 117. static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 118. { 119. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); ^ 120. } 121.
https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/include/internal/constant_time_locl.h/#L119
d2a_code_trace_data_45940
ngx_pool_t * ngx_create_pool(size_t size, ngx_log_t *log) { ngx_pool_t *p; p = ngx_alloc(size, log); if (p == NULL) { return NULL; } p->d.last = (u_char *) p + sizeof(ngx_pool_t); p->d.end = (u_char *) p + size; p->d.next = NULL; size = size - sizeof(ngx_pool_t); p->max = (size < NGX_MAX_ALLOC_FROM_POOL) ? size : NGX_MAX_ALLOC_FROM_POOL; p->current = p; p->chain = NULL; p->large = NULL; p->cleanup = NULL; p->log = log; return p; } src/event/ngx_event_accept.c:99: error: Integer Overflow L2 ([0, +oo] - 72):unsigned64 by call to `ngx_create_pool`. src/event/ngx_event_accept.c:49:13: Unknown value from: accept 47. socklen = NGX_SOCKADDRLEN; 48. 49. s = accept(lc->fd, (struct sockaddr *) sa, &socklen); ^ 50. 51. if (s == -1) { src/event/ngx_event_accept.c:99:19: Call 97. #endif 98. 99. c->pool = ngx_create_pool(ls->pool_size, ev->log); ^ 100. if (c->pool == NULL) { 101. ngx_close_accepted_connection(c); src/core/ngx_palloc.c:15:1: <LHS trace> 13. 14. 15. ngx_pool_t * ^ 16. ngx_create_pool(size_t size, ngx_log_t *log) 17. { src/core/ngx_palloc.c:15:1: Parameter `size` 13. 14. 15. ngx_pool_t * ^ 16. ngx_create_pool(size_t size, ngx_log_t *log) 17. { src/core/ngx_palloc.c:29:5: Binary operation: ([0, +oo] - 72):unsigned64 by call to `ngx_create_pool` 27. p->d.next = NULL; 28. 29. size = size - sizeof(ngx_pool_t); ^ 30. p->max = (size < NGX_MAX_ALLOC_FROM_POOL) ? size : NGX_MAX_ALLOC_FROM_POOL; 31.
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_palloc.c/#L29
d2a_code_trace_data_45941
static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; MOVStreamContext *sc = st->priv_data; unsigned int i, entries; get_byte(pb); get_be24(pb); entries = get_be32(pb); if(entries >= UINT_MAX / sizeof(MOV_stts_t)) return -1; sc->ctts_count = entries; sc->ctts_data = av_malloc(entries * sizeof(MOV_stts_t)); if (!sc->ctts_data) return -1; dprintf(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries); for(i=0; i<entries; i++) { int count =get_be32(pb); int duration =get_be32(pb); if (duration < 0) { av_log(c->fc, AV_LOG_ERROR, "negative ctts, ignoring\n"); sc->ctts_count = 0; url_fskip(pb, 8 * (entries - i - 1)); break; } sc->ctts_data[i].count = count; sc->ctts_data[i].duration= duration; sc->time_rate= ff_gcd(sc->time_rate, duration); } return 0; } libavformat/mov.c:1102: error: Integer Overflow L2 ([1, 536870910] - [0, 536870909]):unsigned32. libavformat/mov.c:1095:9: <LHS trace> 1093. dprintf(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries); 1094. 1095. for(i=0; i<entries; i++) { ^ 1096. int count =get_be32(pb); 1097. int duration =get_be32(pb); libavformat/mov.c:1095:9: Assignment 1093. dprintf(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries); 1094. 1095. for(i=0; i<entries; i++) { ^ 1096. int count =get_be32(pb); 1097. int duration =get_be32(pb); libavformat/mov.c:1095:9: <RHS trace> 1093. dprintf(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries); 1094. 1095. for(i=0; i<entries; i++) { ^ 1096. int count =get_be32(pb); 1097. int duration =get_be32(pb); libavformat/mov.c:1095:9: Assignment 1093. dprintf(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries); 1094. 1095. for(i=0; i<entries; i++) { ^ 1096. int count =get_be32(pb); 1097. int duration =get_be32(pb); libavformat/mov.c:1102:13: Binary operation: ([1, 536870910] - [0, 536870909]):unsigned32 1100. av_log(c->fc, AV_LOG_ERROR, "negative ctts, ignoring\n"); 1101. sc->ctts_count = 0; 1102. url_fskip(pb, 8 * (entries - i - 1)); ^ 1103. break; 1104. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/mov.c/#L1102
d2a_code_trace_data_45942
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return 0; r->neg = a->neg; lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return 1; } crypto/dh/dh_check.c:166: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_is_prime_ex`. Showing all 49 steps of the trace crypto/dh/dh_check.c:136:14: Call 134. *ret |= DH_CHECK_Q_NOT_PRIME; 135. /* Check p == 1 mod q i.e. q divides p - 1 */ 136. if (!BN_div(t1, t2, dh->p, dh->q, ctx)) ^ 137. goto err; 138. if (!BN_is_one(t2)) crypto/bn/bn_div.c:137:1: Parameter `dv->top` 135. * If 'dv' or 'rm' is NULL, the respective value is not returned. 136. */ 137. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 138. BN_CTX *ctx) 139. { crypto/dh/dh_check.c:166:13: Call 164. if (!BN_rshift1(t1, dh->p)) 165. goto err; 166. r = BN_is_prime_ex(t1, BN_prime_checks, ctx, NULL); ^ 167. if (r < 0) 168. goto err; crypto/bn/bn_prime.c:145:1: Parameter `a->top` 143. } 144. 145. > int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 146. BN_GENCB *cb) 147. { crypto/bn/bn_prime.c:148:12: Call 146. BN_GENCB *cb) 147. { 148. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 149. } 150. crypto/bn/bn_prime.c:151:1: Parameter `a->top` 149. } 150. 151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 152. int do_trial_division, BN_GENCB *cb) 153. { crypto/bn/bn_prime.c:161:9: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_prime.c:161:29: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_prime.c:165:10: Call 163. 164. /* Check odd and bigger than 1 */ 165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0) ^ 166. return 0; 167. crypto/bn/bn_lib.c:860:1: Parameter `a->top` 858. } 859. 860. > int BN_is_odd(const BIGNUM *a) 861. { 862. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_prime.c:165:26: Call 163. 164. /* Check odd and bigger than 1 */ 165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0) ^ 166. return 0; 167. crypto/bn/bn_lib.c:542:1: Parameter `a->top` 540. } 541. 542. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 543. { 544. int i; crypto/bn/bn_prime.c:198:10: Call 196. 197. /* compute A1 := a - 1 */ 198. if (!BN_copy(A1, a) || !BN_sub_word(A1, 1)) ^ 199. goto err; 200. /* compute A3 := a - 3 */ crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:201:10: Call 199. goto err; 200. /* compute A3 := a - 3 */ 201. if (!BN_copy(A3, a) || !BN_sub_word(A3, 3)) ^ 202. goto err; 203. crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:215:10: Call 213. if (mont == NULL) 214. goto err; 215. if (!BN_MONT_CTX_set(mont, a, ctx)) ^ 216. goto err; 217. crypto/bn/bn_mont.c:238:9: Call 236. BIGNUM *Ri, *R; 237. 238. if (BN_is_zero(mod)) ^ 239. return 0; 240. crypto/bn/bn_lib.c:845:1: Parameter `a->top` 843. } 844. 845. > int BN_is_zero(const BIGNUM *a) 846. { 847. return a->top == 0; crypto/bn/bn_prime.c:223:13: Call 221. goto err; 222. 223. j = witness(check, a, A1, A1_odd, k, ctx, mont); ^ 224. if (j == -1) 225. goto err; crypto/bn/bn_prime.c:245:1: Parameter `a->top` 243. } 244. 245. > static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, 246. const BIGNUM *a1_odd, int k, BN_CTX *ctx, 247. BN_MONT_CTX *mont) crypto/bn/bn_prime.c:249:10: Call 247. BN_MONT_CTX *mont) 248. { 249. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */ ^ 250. return -1; 251. if (BN_is_one(w)) crypto/bn/bn_exp.c:296:1: Parameter `m->top` 294. } 295. 296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 298. { crypto/bn/bn_exp.c:310:16: Call 308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { 310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 311. } 312. crypto/bn/bn_exp.c:596:1: Parameter `m->top` 594. * http://www.daemonology.net/hyperthreading-considered-harmful/) 595. */ 596. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 597. const BIGNUM *m, BN_CTX *ctx, 598. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:617:10: Call 615. bn_check_top(m); 616. 617. if (!BN_is_odd(m)) { ^ 618. BNerr(BN_F_BN_MOD_EXP_MONT_CONSTTIME, BN_R_CALLED_WITH_EVEN_MODULUS); 619. return 0; crypto/bn/bn_lib.c:860:1: Parameter `a->top` 858. } 859. 860. > int BN_is_odd(const BIGNUM *a) 861. { 862. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_exp.c:755:14: Call 753. /* prepare a^1 in Montgomery domain */ 754. if (a->neg || BN_ucmp(a, m) >= 0) { 755. if (!BN_nnmod(&am, a, m, ctx)) ^ 756. goto err; 757. if (!BN_to_montgomery(&am, &am, mont, ctx)) crypto/bn/bn_mod.c:13:1: Parameter `d->top` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:199:31: Call 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_lib.c:140:9: Assignment 138. 139. if (BN_is_zero(a)) 140. return 0; ^ 141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 142. } crypto/bn/bn_div.c:199:5: Assignment 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_div.c:200:11: Call 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) ^ 201. goto err; 202. sdiv->neg = 0; crypto/bn/bn_shift.c:83:1: <Offset trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `n` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:5: Assignment 95. } 96. 97. nw = n / BN_BITS2; ^ 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) 99. return 0; crypto/bn/bn_shift.c:83:1: <Length trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `*r->d` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:98:9: Call 96. 97. nw = n / BN_BITS2; 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 99. return 0; 100. r->neg = a->neg; crypto/bn/bn_lib.c:941:1: Parameter `*a->d` 939. } 940. 941. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 942. { 943. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:104:5: Assignment 102. rb = BN_BITS2 - lb; 103. f = a->d; 104. t = r->d; ^ 105. t[a->top + nw] = 0; 106. if (lb == 0) crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_is_prime_ex` 110. for (i = a->top - 1; i >= 0; i--) { 111. l = f[i]; 112. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 113. t[nw + i] = (l << lb) & BN_MASK2; 114. }
https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_shift.c/#L112
d2a_code_trace_data_45943
DECLAREContigPutFunc(put4bitbwtile) { uint32** BWmap = img->BWmap; (void) x; (void) y; fromskew /= 2; while (h-- > 0) { uint32* bw; UNROLL2(w, bw = BWmap[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } libtiff/tif_getimage.c:1225: error: Integer Overflow L2 ([0, `h`] - 1):unsigned32. libtiff/tif_getimage.c:1219:1: <LHS trace> 1217. * 4-bit greyscale => colormap/RGB 1218. */ 1219. DECLAREContigPutFunc(put4bitbwtile) ^ 1220. { 1221. uint32** BWmap = img->BWmap; libtiff/tif_getimage.c:1219:1: Parameter `h` 1217. * 4-bit greyscale => colormap/RGB 1218. */ 1219. DECLAREContigPutFunc(put4bitbwtile) ^ 1220. { 1221. uint32** BWmap = img->BWmap; libtiff/tif_getimage.c:1225:12: Binary operation: ([0, h] - 1):unsigned32 1223. (void) x; (void) y; 1224. fromskew /= 2; 1225. while (h-- > 0) { ^ 1226. uint32* bw; 1227. UNROLL2(w, bw = BWmap[*pp++], *cp++ = *bw++);
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_getimage.c/#L1225
d2a_code_trace_data_45944
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } crypto/dsa/dsa_ossl.c:285: error: BUFFER_OVERRUN_L3 Offset: [31, +oo] Size: [0, 8388607] by call to `BN_mod_mul`. Showing all 15 steps of the trace crypto/dsa/dsa_ossl.c:281:10: Call 279. 280. /* u1 = M * w mod q */ 281. if (!BN_mod_mul(u1, u1, u2, dsa->q, ctx)) ^ 282. goto err; 283. crypto/bn/bn_mod.c:73:1: Parameter `r->top` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/dsa/dsa_ossl.c:285:10: Call 283. 284. /* u2 = r * w mod q */ 285. if (!BN_mod_mul(u2, r, u2, dsa->q, ctx)) ^ 286. goto err; 287. crypto/bn/bn_mod.c:73:1: Parameter `a->top` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/bn/bn_mod.c:87:14: Call 85. goto err; 86. if (a == b) { 87. if (!BN_sqr(t, a, ctx)) ^ 88. goto err; 89. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:104:1: <Offset trace> 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:104:1: Parameter `n` 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:110:5: Assignment 108. BN_ULONG *rp; 109. 110. max = n * 2; ^ 111. ap = a; 112. rp = r; crypto/bn/bn_sqr.c:104:1: <Length trace> 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:104:1: Parameter `*r` 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:112:5: Assignment 110. max = n * 2; 111. ap = a; 112. rp = r; ^ 113. rp[0] = rp[max - 1] = 0; 114. rp++; crypto/bn/bn_sqr.c:113:13: Array access: Offset: [31, +oo] Size: [0, 8388607] by call to `BN_mod_mul` 111. ap = a; 112. rp = r; 113. rp[0] = rp[max - 1] = 0; ^ 114. rp++; 115. j = n;
https://github.com/openssl/openssl/blob/aa951ef3d745aa0c32b984fd9be2cc21382b97f6/crypto/bn/bn_sqr.c/#L113
d2a_code_trace_data_45945
int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[]) { int num,len,i; char *p; *argc=0; *argv=NULL; len=strlen(buf); i=0; if (arg->count == 0) { arg->count=20; arg->data=(char **)OPENSSL_malloc(sizeof(char *)*arg->count); } for (i=0; i<arg->count; i++) arg->data[i]=NULL; num=0; p=buf; for (;;) { if (!*p) break; while (*p && ((*p == ' ') || (*p == '\t') || (*p == '\n'))) p++; if (!*p) break; if (num >= arg->count) { arg->count+=20; arg->data=(char **)OPENSSL_realloc(arg->data, sizeof(char *)*arg->count); if (argc == 0) return(0); } arg->data[num++]=p; if ((*p == '\'') || (*p == '\"')) { i= *(p++); arg->data[num-1]++; while (*p && (*p != i)) p++; *p='\0'; } else { while (*p && ((*p != ' ') && (*p != '\t') && (*p != '\n'))) p++; if (*p == '\0') p--; else *p='\0'; } p++; } *argc=num; *argv=arg->data; return(1); } apps/apps.c:398: error: NULL_DEREFERENCE pointer `arg->data` last assigned on line 395 could be null and is dereferenced at line 398, column 3. Showing all 24 steps of the trace apps/apps.c:382:1: start of procedure chopup_args() 380. #endif 381. 382. > int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[]) 383. { 384. int num,len,i; apps/apps.c:387:2: 385. char *p; 386. 387. > *argc=0; 388. *argv=NULL; 389. apps/apps.c:388:2: 386. 387. *argc=0; 388. > *argv=NULL; 389. 390. len=strlen(buf); apps/apps.c:390:2: 388. *argv=NULL; 389. 390. > len=strlen(buf); 391. i=0; 392. if (arg->count == 0) apps/apps.c:391:2: 389. 390. len=strlen(buf); 391. > i=0; 392. if (arg->count == 0) 393. { apps/apps.c:392:6: Taking true branch 390. len=strlen(buf); 391. i=0; 392. if (arg->count == 0) ^ 393. { 394. arg->count=20; apps/apps.c:394:3: 392. if (arg->count == 0) 393. { 394. > arg->count=20; 395. arg->data=(char **)OPENSSL_malloc(sizeof(char *)*arg->count); 396. } apps/apps.c:395:3: 393. { 394. arg->count=20; 395. > arg->data=(char **)OPENSSL_malloc(sizeof(char *)*arg->count); 396. } 397. for (i=0; i<arg->count; i++) crypto/mem.c:291:1: start of procedure CRYPTO_malloc() 289. } 290. 291. > void *CRYPTO_malloc(int num, const char *file, int line) 292. { 293. void *ret = NULL; crypto/mem.c:293:2: 291. void *CRYPTO_malloc(int num, const char *file, int line) 292. { 293. > void *ret = NULL; 294. extern unsigned char cleanse_ctr; 295. crypto/mem.c:296:6: Taking false branch 294. extern unsigned char cleanse_ctr; 295. 296. if (num < 0) return NULL; ^ 297. 298. allow_customize = 0; crypto/mem.c:298:2: 296. if (num < 0) return NULL; 297. 298. > allow_customize = 0; 299. if (malloc_debug_func != NULL) 300. { crypto/mem.c:299:6: Taking true branch 297. 298. allow_customize = 0; 299. if (malloc_debug_func != NULL) ^ 300. { 301. allow_customize_debug = 0; crypto/mem.c:301:3: 299. if (malloc_debug_func != NULL) 300. { 301. > allow_customize_debug = 0; 302. malloc_debug_func(NULL, num, file, line, 0); 303. } crypto/mem.c:302:3: Skipping __function_pointer__(): unresolved function pointer 300. { 301. allow_customize_debug = 0; 302. malloc_debug_func(NULL, num, file, line, 0); ^ 303. } 304. ret = malloc_ex_func(num,file,line); crypto/mem.c:304:2: Skipping __function_pointer__(): unresolved function pointer 302. malloc_debug_func(NULL, num, file, line, 0); 303. } 304. ret = malloc_ex_func(num,file,line); ^ 305. #ifdef LEVITTE_DEBUG_MEM 306. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); crypto/mem.c:308:6: Taking true branch 306. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); 307. #endif 308. if (malloc_debug_func != NULL) ^ 309. malloc_debug_func(ret, num, file, line, 1); 310. crypto/mem.c:309:3: Skipping __function_pointer__(): unresolved function pointer 307. #endif 308. if (malloc_debug_func != NULL) 309. malloc_debug_func(ret, num, file, line, 1); ^ 310. 311. /* Create a dependency on the value of 'cleanse_ctr' so our memory crypto/mem.c:314:12: Taking false branch 312. * sanitisation function can't be optimised out. NB: We only do 313. * this for >2Kb so the overhead doesn't bother us. */ 314. if(ret && (num > 2048)) ^ 315. ((unsigned char *)ret)[0] = cleanse_ctr; 316. crypto/mem.c:317:2: 315. ((unsigned char *)ret)[0] = cleanse_ctr; 316. 317. > return ret; 318. } 319. crypto/mem.c:318:2: return from a call to CRYPTO_malloc 316. 317. return ret; 318. } ^ 319. 320. void *CRYPTO_realloc(void *str, int num, const char *file, int line) apps/apps.c:397:7: 395. arg->data=(char **)OPENSSL_malloc(sizeof(char *)*arg->count); 396. } 397. > for (i=0; i<arg->count; i++) 398. arg->data[i]=NULL; 399. apps/apps.c:397:12: Loop condition is true. Entering loop body 395. arg->data=(char **)OPENSSL_malloc(sizeof(char *)*arg->count); 396. } 397. for (i=0; i<arg->count; i++) ^ 398. arg->data[i]=NULL; 399. apps/apps.c:398:3: 396. } 397. for (i=0; i<arg->count; i++) 398. > arg->data[i]=NULL; 399. 400. num=0;
https://github.com/openssl/openssl/blob/03ddbdd9b99ea60d0967b831ffc1fe93ae7f9792/apps/apps.c/#L398
d2a_code_trace_data_45946
static void opt_vstats (void) { char filename[40]; time_t today2 = time(NULL); struct tm *today = localtime(&today2); snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, today->tm_sec); opt_vstats_file(filename); } ffmpeg.c:4062: error: Null Dereference pointer `today` last assigned on line 4060 could be null and is dereferenced at line 4062, column 69. ffmpeg.c:4056:1: start of procedure opt_vstats() 4054. } 4055. 4056. static void opt_vstats (void) ^ 4057. { 4058. char filename[40]; ffmpeg.c:4059:5: 4057. { 4058. char filename[40]; 4059. time_t today2 = time(NULL); ^ 4060. struct tm *today = localtime(&today2); 4061. ffmpeg.c:4060:5: 4058. char filename[40]; 4059. time_t today2 = time(NULL); 4060. struct tm *today = localtime(&today2); ^ 4061. 4062. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, ffmpeg.c:4062:5: 4060. struct tm *today = localtime(&today2); 4061. 4062. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, ^ 4063. today->tm_sec); 4064. opt_vstats_file(filename);
https://github.com/libav/libav/blob/27241cbffe180fc92f9f519c6ea7957fc4b3b0c9/ffmpeg.c/#L4062
d2a_code_trace_data_45947
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/bn/bn_mont.c:70: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, +oo] by call to `bn_mul_fixed_top`. Showing all 17 steps of the trace crypto/bn/bn_mont.c:61:11: Call 59. 60. BN_CTX_start(ctx); 61. tmp = BN_CTX_get(ctx); ^ 62. if (tmp == NULL) 63. goto err; crypto/bn/bn_ctx.c:219:5: Call 217. } 218. /* OK, make sure the returned bignum is "zero" */ 219. BN_zero(ret); ^ 220. /* clear BN_FLG_CONSTTIME if leaked from previous frames */ 221. ret->flags &= (~BN_FLG_CONSTTIME); crypto/bn/bn_lib.c:359:1: Parameter `*a->d` 357. } 358. 359. > int BN_set_word(BIGNUM *a, BN_ULONG w) 360. { 361. bn_check_top(a); crypto/bn/bn_lib.c:362:9: Call 360. { 361. bn_check_top(a); 362. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 363. return 0; 364. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `*a->d` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_mont.c:70:14: Call 68. goto err; 69. } else { 70. if (!bn_mul_fixed_top(tmp, a, b, ctx)) ^ 71. goto err; 72. } crypto/bn/bn_mul.c:507:1: Parameter `*r->d` 505. } 506. 507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 508. { 509. int ret = 0; crypto/bn/bn_mul.c:555:17: Call 553. # endif 554. if (al == 8) { 555. if (bn_wexpand(rr, 16) == NULL) ^ 556. goto err; 557. rr->top = 16; crypto/bn/bn_lib.c:960:1: Parameter `*a->d` 958. } 959. 960. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 961. { 962. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:962:37: Call 960. BIGNUM *bn_wexpand(BIGNUM *a, int words) 961. { 962. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 963. } 964. crypto/bn/bn_lib.c:245:1: Parameter `*b->d` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `*b->d` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, +oo] by call to `bn_mul_fixed_top` 230. assert(b->top <= words); 231. if (b->top > 0) 232. memcpy(a, b->d, sizeof(*a) * b->top); ^ 233. 234. return a;
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_45948
static void new_data_stream(AVFormatContext *oc, int file_idx) { AVStream *st; AVOutputStream *ost; AVCodec *codec=NULL; AVCodecContext *data_enc; st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); if (!st) { fprintf(stderr, "Could not alloc stream\n"); ffmpeg_exit(1); } ost = new_output_stream(oc, file_idx); data_enc = st->codec; output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); if (!data_stream_copy) { fprintf(stderr, "Data stream encoding not supported yet (only streamcopy)\n"); ffmpeg_exit(1); } avcodec_get_context_defaults3(st->codec, codec); data_enc->codec_type = AVMEDIA_TYPE_DATA; if (data_codec_tag) data_enc->codec_tag= data_codec_tag; if (oc->oformat->flags & AVFMT_GLOBALHEADER) { data_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avcodec_opts[AVMEDIA_TYPE_DATA]->flags |= CODEC_FLAG_GLOBAL_HEADER; } if (data_stream_copy) { st->stream_copy = 1; } data_disable = 0; av_freep(&data_codec_name); data_stream_copy = 0; } ffmpeg.c:3646: error: Null Dereference pointer `st` last assigned on line 3640 could be null and is dereferenced at line 3646, column 16. ffmpeg.c:3633:1: start of procedure new_data_stream() 3631. } 3632. 3633. static void new_data_stream(AVFormatContext *oc, int file_idx) ^ 3634. { 3635. AVStream *st; ffmpeg.c:3637:5: 3635. AVStream *st; 3636. AVOutputStream *ost; 3637. AVCodec *codec=NULL; ^ 3638. AVCodecContext *data_enc; 3639. ffmpeg.c:3640:28: Condition is true 3638. AVCodecContext *data_enc; 3639. 3640. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3641. if (!st) { 3642. fprintf(stderr, "Could not alloc stream\n"); ffmpeg.c:3640:5: 3638. AVCodecContext *data_enc; 3639. 3640. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3641. if (!st) { 3642. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2588:1: start of procedure av_new_stream() 2586. } 2587. 2588. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2589. { 2590. AVStream *st; libavformat/utils.c:2594:9: Taking true branch 2592. AVStream **streams; 2593. 2594. if (s->nb_streams >= INT_MAX/sizeof(*streams)) ^ 2595. return NULL; 2596. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); libavformat/utils.c:2595:9: 2593. 2594. if (s->nb_streams >= INT_MAX/sizeof(*streams)) 2595. return NULL; ^ 2596. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); 2597. if (!streams) libavformat/utils.c:2637:1: return from a call to av_new_stream 2635. s->streams[s->nb_streams++] = st; 2636. return st; 2637. } ^ 2638. 2639. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:3641:10: Taking true branch 3639. 3640. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3641. if (!st) { ^ 3642. fprintf(stderr, "Could not alloc stream\n"); 3643. ffmpeg_exit(1); ffmpeg.c:3642:9: 3640. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3641. if (!st) { 3642. fprintf(stderr, "Could not alloc stream\n"); ^ 3643. ffmpeg_exit(1); 3644. } ffmpeg.c:3643:9: Skipping ffmpeg_exit(): empty list of specs 3641. if (!st) { 3642. fprintf(stderr, "Could not alloc stream\n"); 3643. ffmpeg_exit(1); ^ 3644. } 3645. ost = new_output_stream(oc, file_idx); ffmpeg.c:3645:5: Skipping new_output_stream(): empty list of specs 3643. ffmpeg_exit(1); 3644. } 3645. ost = new_output_stream(oc, file_idx); ^ 3646. data_enc = st->codec; 3647. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); ffmpeg.c:3646:5: 3644. } 3645. ost = new_output_stream(oc, file_idx); 3646. data_enc = st->codec; ^ 3647. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); 3648. if (!data_stream_copy) {
https://github.com/libav/libav/blob/6465c820da7b104150366a8cdd837c00cf364235/ffmpeg.c/#L3646
d2a_code_trace_data_45949
int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) { char *v; int gmt = 0; int i; int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0; char *f = NULL; int f_len = 0; i = tm->length; v = (char *)tm->data; if (i < 12) goto err; if (v[i - 1] == 'Z') gmt = 1; for (i = 0; i < 12; i++) if ((v[i] > '9') || (v[i] < '0')) goto err; y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 + (v[2] - '0') * 10 + (v[3] - '0'); M = (v[4] - '0') * 10 + (v[5] - '0'); if ((M > 12) || (M < 1)) goto err; d = (v[6] - '0') * 10 + (v[7] - '0'); h = (v[8] - '0') * 10 + (v[9] - '0'); m = (v[10] - '0') * 10 + (v[11] - '0'); if (tm->length >= 14 && (v[12] >= '0') && (v[12] <= '9') && (v[13] >= '0') && (v[13] <= '9')) { s = (v[12] - '0') * 10 + (v[13] - '0'); if (tm->length >= 15 && v[14] == '.') { int l = tm->length; f = &v[14]; f_len = 1; while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9') ++f_len; } } if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", _asn1_mon[M - 1], d, h, m, s, f_len, f, y, (gmt) ? " GMT" : "") <= 0) return (0); else return (1); err: BIO_write(bp, "Bad time value", 14); return (0); } crypto/ocsp/v3_ocsp.c:183: error: BUFFER_OVERRUN_L3 Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print`. Showing all 9 steps of the trace crypto/ocsp/v3_ocsp.c:167:14: Call 165. if (BIO_printf(bp, "%*scrlUrl: ", ind, "") <= 0) 166. goto err; 167. if (!ASN1_STRING_print(bp, (ASN1_STRING *)a->crlUrl)) ^ 168. goto err; 169. if (BIO_write(bp, "\n", 1) <= 0) crypto/asn1/a_print.c:130:1: Parameter `*v->data` 128. } 129. 130. > int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v) 131. { 132. int i, n; crypto/ocsp/v3_ocsp.c:183:14: Call 181. if (BIO_printf(bp, "%*scrlTime: ", ind, "") <= 0) 182. goto err; 183. if (!ASN1_GENERALIZEDTIME_print(bp, a->crlTime)) ^ 184. goto err; 185. if (BIO_write(bp, "\n", 1) <= 0) crypto/asn1/a_gentm.c:266:1: <Offset trace> 264. }; 265. 266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 267. { 268. char *v; crypto/asn1/a_gentm.c:266:1: Parameter `*tm->data` 264. }; 265. 266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 267. { 268. char *v; crypto/asn1/a_gentm.c:287:5: Assignment 285. y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 286. + (v[2] - '0') * 10 + (v[3] - '0'); 287. M = (v[4] - '0') * 10 + (v[5] - '0'); ^ 288. if ((M > 12) || (M < 1)) 289. goto err; crypto/asn1/a_gentm.c:261:1: <Length trace> 259. } 260. 261. > const char *_asn1_mon[12] = { 262. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/a_gentm.c:261:1: Array declaration 259. } 260. 261. > const char *_asn1_mon[12] = { 262. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/a_gentm.c:308:20: Array access: Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print` 306. 307. if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", 308. _asn1_mon[M - 1], d, h, m, s, f_len, f, y, ^ 309. (gmt) ? " GMT" : "") <= 0) 310. return (0);
https://github.com/openssl/openssl/blob/01b7851aa27aa144372f5484da916be042d9aa4f/crypto/asn1/a_gentm.c/#L308
d2a_code_trace_data_45950
static int var_diamond_search(MpegEncContext * s, int *best, int dmin, int src_index, int ref_index, int const penalty_factor, int size, int h, int flags) { MotionEstContext * const c= &s->me; me_cmp_func cmpf, chroma_cmpf; int dia_size; LOAD_COMMON LOAD_COMMON2 int map_generation= c->map_generation; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; for(dia_size=1; dia_size<=c->dia_size; dia_size++){ int dir, start, end; const int x= best[0]; const int y= best[1]; start= FFMAX(0, y + dia_size - ymax); end = FFMIN(dia_size, xmax - x + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dir , y + dia_size - dir); } start= FFMAX(0, x + dia_size - xmax); end = FFMIN(dia_size, y - ymin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dia_size - dir, y - dir ); } start= FFMAX(0, -y + dia_size + ymin ); end = FFMIN(dia_size, x - xmin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dir , y - dia_size + dir); } start= FFMAX(0, -x + dia_size + xmin ); end = FFMIN(dia_size, ymax - y + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dia_size + dir, y + dir ); } if(x!=best[0] || y!=best[1]) dia_size=0; #if 0 { int dx, dy, i; static int stats[8*8]; dx= FFABS(x-best[0]); dy= FFABS(y-best[1]); stats[dy*8 + dx] ++; if(256*256*256*64 % (stats[0]+1)==0){ for(i=0; i<64; i++){ if((i&7)==0) printf("\n"); printf("%6d ", stats[i]); } printf("\n"); } } #endif } return dmin; } libavcodec/motion_est_template.c:921: error: Uninitialized Value The value read from ymin was never initialized. libavcodec/motion_est_template.c:921:13: 919. 920. //check(x + dir,y + dia_size - dir,0, a0) 921. CHECK_MV(x + dir , y + dia_size - dir); ^ 922. } 923.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L921
d2a_code_trace_data_45951
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_crpt.c:184: error: INTEGER_OVERFLOW_L2 ([0, 4+max(0, `ctx->stack.depth`)] - 1):unsigned32 by call to `BN_mod_inverse`. Showing all 23 steps of the trace crypto/rsa/rsa_crpt.c:165:1: Parameter `ctx->stack.depth` 163. } 164. 165. > static BIGNUM *rsa_get_public_exp(const BIGNUM *d, const BIGNUM *p, 166. const BIGNUM *q, BN_CTX *ctx) 167. { crypto/rsa/rsa_crpt.c:173:2: Call 171. return NULL; 172. 173. BN_CTX_start(ctx); ^ 174. r0 = BN_CTX_get(ctx); 175. r1 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/rsa/rsa_crpt.c:182:7: Call 180. if (!BN_sub(r1, p, BN_value_one())) goto err; 181. if (!BN_sub(r2, q, BN_value_one())) goto err; 182. if (!BN_mul(r0, r1, r2, ctx)) goto err; ^ 183. 184. ret = BN_mod_inverse(NULL, d, r0, ctx); crypto/bn/bn_mul.c:943:1: Parameter `ctx->stack.depth` 941. #endif /* BN_RECURSION */ 942. 943. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 944. { 945. int ret=0; crypto/rsa/rsa_crpt.c:184:8: Call 182. if (!BN_mul(r0, r1, r2, ctx)) goto err; 183. 184. ret = BN_mod_inverse(NULL, d, r0, ctx); ^ 185. err: 186. BN_CTX_end(ctx); crypto/bn/bn_gcd.c:209:1: Parameter `ctx->stack.depth` 207. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); 208. 209. > BIGNUM *BN_mod_inverse(BIGNUM *in, 210. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 211. { crypto/bn/bn_gcd.c:218:10: Call 216. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) 217. { 218. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 219. } 220. crypto/bn/bn_gcd.c:507:1: Parameter `ctx->stack.depth` 505. * It does not contain branches that may leak sensitive information. 506. */ 507. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 508. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 509. { crypto/bn/bn_gcd.c:519:2: Call 517. bn_check_top(n); 518. 519. BN_CTX_start(ctx); ^ 520. A = BN_CTX_get(ctx); 521. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:548:8: Call 546. pB = &local_B; 547. BN_with_flags(pB, B, BN_FLG_CONSTTIME); 548. if (!BN_nnmod(B, pB, A, ctx)) goto err; ^ 549. } 550. sign = -1; crypto/bn/bn_mod.c:127:1: Parameter `ctx->stack.depth` 125. 126. 127. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 128. { 129. /* like BN_mod, but returns non-negative remainder crypto/bn/bn_mod.c:132:8: Call 130. * (i.e., 0 <= r < |d| always holds) */ 131. 132. if (!(BN_mod(r,m,d,ctx))) ^ 133. return 0; 134. if (!r->neg) crypto/bn/bn_div.c:181:1: Parameter `ctx->stack.depth` 179. * If 'dv' or 'rm' is NULL, the respective value is not returned. 180. */ 181. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 182. BN_CTX *ctx) 183. { crypto/bn/bn_div.c:226:2: Call 224. } 225. 226. BN_CTX_start(ctx); ^ 227. tmp=BN_CTX_get(ctx); 228. snum=BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:441:2: Call 439. } 440. if (no_branch) bn_correct_top(res); 441. BN_CTX_end(ctx); ^ 442. return(1); 443. err: crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth` 268. } 269. 270. > void BN_CTX_end(BN_CTX *ctx) 271. { 272. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:277:21: Call 275. else 276. { 277. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 278. /* Does this stack frame have anything to release? */ 279. if(fp < ctx->used) crypto/bn/bn_ctx.c:351:1: <LHS trace> 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:351:1: Parameter `st->depth` 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:353:9: Binary operation: ([0, 4+max(0, ctx->stack.depth)] - 1):unsigned32 by call to `BN_mod_inverse` 351. static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; ^ 354. } 355.
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bn/bn_ctx.c/#L353
d2a_code_trace_data_45952
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) { PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | (diff > (0 - (PTRDIFF_T)len))); return overlapped; } crypto/evp/bio_enc.c:270: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate`. Showing all 9 steps of the trace crypto/evp/bio_enc.c:270:14: Call 268. while (inl > 0) { 269. n = (inl > ENC_BLOCK_SIZE) ? ENC_BLOCK_SIZE : inl; 270. if (!EVP_CipherUpdate(ctx->cipher, ^ 271. ctx->buf, &ctx->buf_len, 272. (const unsigned char *)in, n)) { crypto/evp/evp_enc.c:205:1: Parameter `ctx->cipher->block_size` 203. } 204. 205. > int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 206. const unsigned char *in, int inl) 207. { crypto/evp/evp_enc.c:211:16: Call 209. return EVP_EncryptUpdate(ctx, out, outl, in, inl); 210. else 211. return EVP_DecryptUpdate(ctx, out, outl, in, inl); ^ 212. } 213. crypto/evp/evp_enc.c:416:1: Parameter `ctx->cipher->block_size` 414. } 415. 416. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 417. const unsigned char *in, int inl) 418. { crypto/evp/evp_enc.c:422:5: Assignment 420. unsigned int b; 421. 422. b = ctx->cipher->block_size; ^ 423. 424. if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { crypto/evp/evp_enc.c:452:16: Call 450. /* see comment about PTRDIFF_T comparison above */ 451. if (((PTRDIFF_T)out == (PTRDIFF_T)in) 452. || is_partially_overlapping(out, in, b)) { ^ 453. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); 454. return 0; crypto/evp/evp_enc.c:279:1: <RHS trace> 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:279:1: Parameter `len` 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:288:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate` 286. */ 287. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | 288. (diff > (0 - (PTRDIFF_T)len))); ^ 289. 290. return overlapped;
https://github.com/openssl/openssl/blob/b1531d8e6cc95837e38b10d875ae64144c6fdf7a/crypto/evp/evp_enc.c/#L288
d2a_code_trace_data_45953
static int config_props(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; AVFilterLink *inlink = outlink->src->inputs[0]; ScaleContext *scale = ctx->priv; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); int64_t w, h; double var_values[VARS_NB], res; char *expr; int ret; var_values[VAR_PI] = M_PI; var_values[VAR_PHI] = M_PHI; var_values[VAR_E] = M_E; var_values[VAR_IN_W] = var_values[VAR_IW] = inlink->w; var_values[VAR_IN_H] = var_values[VAR_IH] = inlink->h; var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN; var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN; var_values[VAR_DAR] = var_values[VAR_A] = (double) inlink->w / inlink->h; var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ? (double) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1; var_values[VAR_HSUB] = 1 << desc->log2_chroma_w; var_values[VAR_VSUB] = 1 << desc->log2_chroma_h; av_expr_parse_and_eval(&res, (expr = scale->w_expr), var_names, var_values, NULL, NULL, NULL, NULL, NULL, 0, ctx); scale->w = var_values[VAR_OUT_W] = var_values[VAR_OW] = res; if ((ret = av_expr_parse_and_eval(&res, (expr = scale->h_expr), var_names, var_values, NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0) goto fail; scale->h = var_values[VAR_OUT_H] = var_values[VAR_OH] = res; if ((ret = av_expr_parse_and_eval(&res, (expr = scale->w_expr), var_names, var_values, NULL, NULL, NULL, NULL, NULL, 0, ctx)) < 0) goto fail; scale->w = res; w = scale->w; h = scale->h; if (w < -1 || h < -1) { av_log(ctx, AV_LOG_ERROR, "Size values less than -1 are not acceptable.\n"); return AVERROR(EINVAL); } if (w == -1 && h == -1) scale->w = scale->h = 0; if (!(w = scale->w)) w = inlink->w; if (!(h = scale->h)) h = inlink->h; if (w == -1) w = av_rescale(h, inlink->w, inlink->h); if (h == -1) h = av_rescale(w, inlink->h, inlink->w); if (w > INT_MAX || h > INT_MAX || (h * inlink->w) > INT_MAX || (w * inlink->h) > INT_MAX) av_log(ctx, AV_LOG_ERROR, "Rescaled value for width or height is too big.\n"); outlink->w = w; outlink->h = h; av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d fmt:%s -> w:%d h:%d fmt:%s flags:0x%0x\n", inlink ->w, inlink ->h, av_get_pix_fmt_name(inlink->format), outlink->w, outlink->h, av_get_pix_fmt_name(outlink->format), scale->flags); scale->input_is_pal = desc->flags & PIX_FMT_PAL || desc->flags & PIX_FMT_PSEUDOPAL; if (scale->sws) sws_freeContext(scale->sws); if (inlink->w == outlink->w && inlink->h == outlink->h && inlink->format == outlink->format) scale->sws = NULL; else { scale->sws = sws_getContext(inlink ->w, inlink ->h, inlink ->format, outlink->w, outlink->h, outlink->format, scale->flags, NULL, NULL, NULL); if (!scale->sws) return AVERROR(EINVAL); } if (inlink->sample_aspect_ratio.num) outlink->sample_aspect_ratio = av_mul_q((AVRational){outlink->h*inlink->w, outlink->w*inlink->h}, inlink->sample_aspect_ratio); else outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; return 0; fail: av_log(NULL, AV_LOG_ERROR, "Error when evaluating the expression '%s'\n", expr); return ret; } libavfilter/vf_scale.c:169: error: Null Dereference pointer `desc` last assigned on line 153 could be null and is dereferenced at line 169, column 34. libavfilter/vf_scale.c:148:1: start of procedure config_props() 146. } 147. 148. static int config_props(AVFilterLink *outlink) ^ 149. { 150. AVFilterContext *ctx = outlink->src; libavfilter/vf_scale.c:150:5: 148. static int config_props(AVFilterLink *outlink) 149. { 150. AVFilterContext *ctx = outlink->src; ^ 151. AVFilterLink *inlink = outlink->src->inputs[0]; 152. ScaleContext *scale = ctx->priv; libavfilter/vf_scale.c:151:5: 149. { 150. AVFilterContext *ctx = outlink->src; 151. AVFilterLink *inlink = outlink->src->inputs[0]; ^ 152. ScaleContext *scale = ctx->priv; 153. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); libavfilter/vf_scale.c:152:5: 150. AVFilterContext *ctx = outlink->src; 151. AVFilterLink *inlink = outlink->src->inputs[0]; 152. ScaleContext *scale = ctx->priv; ^ 153. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); 154. int64_t w, h; libavfilter/vf_scale.c:153:5: 151. AVFilterLink *inlink = outlink->src->inputs[0]; 152. ScaleContext *scale = ctx->priv; 153. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); ^ 154. int64_t w, h; 155. double var_values[VARS_NB], res; libavutil/pixdesc.c:1464:1: start of procedure av_pix_fmt_desc_get() 1462. } 1463. 1464. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1465. { 1466. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1466:9: Taking false branch 1464. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1465. { 1466. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1467. return NULL; 1468. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1466:24: Taking true branch 1464. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1465. { 1466. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1467. return NULL; 1468. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1467:9: 1465. { 1466. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1467. return NULL; ^ 1468. return &av_pix_fmt_descriptors[pix_fmt]; 1469. } libavutil/pixdesc.c:1469:1: return from a call to av_pix_fmt_desc_get 1467. return NULL; 1468. return &av_pix_fmt_descriptors[pix_fmt]; 1469. } ^ 1470. 1471. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libavfilter/vf_scale.c:159:5: 157. int ret; 158. 159. var_values[VAR_PI] = M_PI; ^ 160. var_values[VAR_PHI] = M_PHI; 161. var_values[VAR_E] = M_E; libavfilter/vf_scale.c:160:5: 158. 159. var_values[VAR_PI] = M_PI; 160. var_values[VAR_PHI] = M_PHI; ^ 161. var_values[VAR_E] = M_E; 162. var_values[VAR_IN_W] = var_values[VAR_IW] = inlink->w; libavfilter/vf_scale.c:161:5: 159. var_values[VAR_PI] = M_PI; 160. var_values[VAR_PHI] = M_PHI; 161. var_values[VAR_E] = M_E; ^ 162. var_values[VAR_IN_W] = var_values[VAR_IW] = inlink->w; 163. var_values[VAR_IN_H] = var_values[VAR_IH] = inlink->h; libavfilter/vf_scale.c:162:5: 160. var_values[VAR_PHI] = M_PHI; 161. var_values[VAR_E] = M_E; 162. var_values[VAR_IN_W] = var_values[VAR_IW] = inlink->w; ^ 163. var_values[VAR_IN_H] = var_values[VAR_IH] = inlink->h; 164. var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN; libavfilter/vf_scale.c:163:5: 161. var_values[VAR_E] = M_E; 162. var_values[VAR_IN_W] = var_values[VAR_IW] = inlink->w; 163. var_values[VAR_IN_H] = var_values[VAR_IH] = inlink->h; ^ 164. var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN; 165. var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN; libavfilter/vf_scale.c:164:5: Skipping __builtin_nanf(): method has no implementation 162. var_values[VAR_IN_W] = var_values[VAR_IW] = inlink->w; 163. var_values[VAR_IN_H] = var_values[VAR_IH] = inlink->h; 164. var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN; ^ 165. var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN; 166. var_values[VAR_DAR] = var_values[VAR_A] = (double) inlink->w / inlink->h; libavfilter/vf_scale.c:165:5: Skipping __builtin_nanf(): method has no implementation 163. var_values[VAR_IN_H] = var_values[VAR_IH] = inlink->h; 164. var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN; 165. var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN; ^ 166. var_values[VAR_DAR] = var_values[VAR_A] = (double) inlink->w / inlink->h; 167. var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ? libavfilter/vf_scale.c:166:5: 164. var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN; 165. var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN; 166. var_values[VAR_DAR] = var_values[VAR_A] = (double) inlink->w / inlink->h; ^ 167. var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ? 168. (double) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1; libavfilter/vf_scale.c:167:29: Condition is true 165. var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN; 166. var_values[VAR_DAR] = var_values[VAR_A] = (double) inlink->w / inlink->h; 167. var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ? ^ 168. (double) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1; 169. var_values[VAR_HSUB] = 1 << desc->log2_chroma_w; libavfilter/vf_scale.c:167:5: 165. var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN; 166. var_values[VAR_DAR] = var_values[VAR_A] = (double) inlink->w / inlink->h; 167. var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ? ^ 168. (double) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1; 169. var_values[VAR_HSUB] = 1 << desc->log2_chroma_w; libavfilter/vf_scale.c:169:5: 167. var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ? 168. (double) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1; 169. var_values[VAR_HSUB] = 1 << desc->log2_chroma_w; ^ 170. var_values[VAR_VSUB] = 1 << desc->log2_chroma_h; 171.
https://github.com/libav/libav/blob/5f87c277bd5caa09cc4f9061d4ccdd58dc121110/libavfilter/vf_scale.c/#L169