id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_44954
static int ssl3_read_n(SSL *s, int n, int max, int extend) { int i,off,newb; if (!extend) { if (s->s3->rbuf.left == 0) s->s3->rbuf.offset = 0; s->packet = s->s3->rbuf.buf + s->s3->rbuf.offset; s->packet_length = 0; } if (s->s3->rbuf.left >= (int)n) { s->packet_length+=n; s->s3->rbuf.left-=n; s->s3->rbuf.offset+=n; return(n); } if (!s->read_ahead) max=n; { int max_max = SSL3_RT_MAX_PACKET_SIZE - s->packet_length; if (s->options & SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER) max_max += SSL3_RT_MAX_EXTRA; if (max > max_max) max = max_max; } if (n > max) { SSLerr(SSL_F_SSL3_READ_N,SSL_R_INTERNAL_ERROR); return -1; } off = s->packet_length; newb = s->s3->rbuf.left; if (s->packet != s->s3->rbuf.buf) { memmove(s->s3->rbuf.buf, s->packet, off+newb); s->packet = s->s3->rbuf.buf; } while (newb < n) { clear_sys_error(); if (s->rbio != NULL) { s->rwstate=SSL_READING; i=BIO_read(s->rbio, &(s->s3->rbuf.buf[off+newb]), max-newb); } else { SSLerr(SSL_F_SSL3_READ_N,SSL_R_READ_BIO_NOT_SET); i = -1; } if (i <= 0) { s->s3->rbuf.left = newb; return(i); } newb+=i; } s->s3->rbuf.offset = off + n; s->s3->rbuf.left = newb - n; s->packet_length += n; s->rwstate=SSL_NOTHING; return(n); } ssl/s3_pkt.c:311: error: INTEGER_OVERFLOW_L2 (18437 - [0, 4+max(34816, `s->s3->rrec.length`)]):unsigned32 by call to `ssl3_read_n`. Showing all 5 steps of the trace ssl/s3_pkt.c:231:1: Parameter `s->packet_length` 229. */ 230. /* used only by ssl3_read_bytes */ 231. > static int ssl3_get_record(SSL *s) 232. { 233. int ssl_major,ssl_minor,al; ssl/s3_pkt.c:311:5: Call 309. /* now s->packet_length == SSL3_RT_HEADER_LENGTH */ 310. i=rr->length; 311. n=ssl3_read_n(s,i,i,1); ^ 312. if (n <= 0) return(n); /* error or non-blocking io */ 313. /* now n == rr->length, ssl/s3_pkt.c:129:1: <RHS trace> 127. 128. /* used only by ssl3_get_record */ 129. > static int ssl3_read_n(SSL *s, int n, int max, int extend) 130. { 131. /* If extend == 0, obtain new n-byte packet; if extend == 1, increase ssl/s3_pkt.c:129:1: Parameter `s->packet_length` 127. 128. /* used only by ssl3_get_record */ 129. > static int ssl3_read_n(SSL *s, int n, int max, int extend) 130. { 131. /* If extend == 0, obtain new n-byte packet; if extend == 1, increase ssl/s3_pkt.c:165:3: Binary operation: (18437 - [0, 4+max(34816, s->s3->rrec.length)]):unsigned32 by call to `ssl3_read_n` 163. { 164. /* avoid buffer overflow */ 165. int max_max = SSL3_RT_MAX_PACKET_SIZE - s->packet_length; ^ 166. if (s->options & SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER) 167. max_max += SSL3_RT_MAX_EXTRA;
https://github.com/openssl/openssl/blob/dab6f09573742df94c4767663565aca3863f8173/ssl/s3_pkt.c/#L165
d2a_code_trace_data_44955
static void pred8x8l_horizontal_down_c(uint8_t *src, int has_topleft, int has_topright, int stride) { PREDICT_8x8_LOAD_TOP; PREDICT_8x8_LOAD_LEFT; PREDICT_8x8_LOAD_TOPLEFT; SRC(0,7)= (l6 + l7 + 1) >> 1; SRC(1,7)= (l5 + 2*l6 + l7 + 2) >> 2; SRC(0,6)=SRC(2,7)= (l5 + l6 + 1) >> 1; SRC(1,6)=SRC(3,7)= (l4 + 2*l5 + l6 + 2) >> 2; SRC(0,5)=SRC(2,6)=SRC(4,7)= (l4 + l5 + 1) >> 1; SRC(1,5)=SRC(3,6)=SRC(5,7)= (l3 + 2*l4 + l5 + 2) >> 2; SRC(0,4)=SRC(2,5)=SRC(4,6)=SRC(6,7)= (l3 + l4 + 1) >> 1; SRC(1,4)=SRC(3,5)=SRC(5,6)=SRC(7,7)= (l2 + 2*l3 + l4 + 2) >> 2; SRC(0,3)=SRC(2,4)=SRC(4,5)=SRC(6,6)= (l2 + l3 + 1) >> 1; SRC(1,3)=SRC(3,4)=SRC(5,5)=SRC(7,6)= (l1 + 2*l2 + l3 + 2) >> 2; SRC(0,2)=SRC(2,3)=SRC(4,4)=SRC(6,5)= (l1 + l2 + 1) >> 1; SRC(1,2)=SRC(3,3)=SRC(5,4)=SRC(7,5)= (l0 + 2*l1 + l2 + 2) >> 2; SRC(0,1)=SRC(2,2)=SRC(4,3)=SRC(6,4)= (l0 + l1 + 1) >> 1; SRC(1,1)=SRC(3,2)=SRC(5,3)=SRC(7,4)= (lt + 2*l0 + l1 + 2) >> 2; SRC(0,0)=SRC(2,1)=SRC(4,2)=SRC(6,3)= (lt + l0 + 1) >> 1; SRC(1,0)=SRC(3,1)=SRC(5,2)=SRC(7,3)= (l0 + 2*lt + t0 + 2) >> 2; SRC(2,0)=SRC(4,1)=SRC(6,2)= (t1 + 2*t0 + lt + 2) >> 2; SRC(3,0)=SRC(5,1)=SRC(7,2)= (t2 + 2*t1 + t0 + 2) >> 2; SRC(4,0)=SRC(6,1)= (t3 + 2*t2 + t1 + 2) >> 2; SRC(5,0)=SRC(7,1)= (t4 + 2*t3 + t2 + 2) >> 2; SRC(6,0)= (t5 + 2*t4 + t3 + 2) >> 2; SRC(7,0)= (t6 + 2*t5 + t4 + 2) >> 2; } libavcodec/h264pred.c:907: error: Uninitialized Value The value read from l7 was never initialized. libavcodec/h264pred.c:907:5: 905. PREDICT_8x8_LOAD_LEFT; 906. PREDICT_8x8_LOAD_TOPLEFT; 907. SRC(0,7)= (l6 + l7 + 1) >> 1; ^ 908. SRC(1,7)= (l5 + 2*l6 + l7 + 2) >> 2; 909. SRC(0,6)=SRC(2,7)= (l5 + l6 + 1) >> 1;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264pred.c/#L907
d2a_code_trace_data_44956
int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, const char *dir) { DIR *d; struct dirent *dstruct; int ret = 0; CRYPTO_w_lock(CRYPTO_LOCK_READDIR); d = opendir(dir); if(!d) { SYSerr(SYS_F_OPENDIR, get_last_sys_error()); ERR_add_error_data(3, "opendir('", dir, "')"); SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB); goto err; } while((dstruct=readdir(d))) { char buf[1024]; int r; if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf) { SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG); goto err; } r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name); if (r <= 0 || r >= sizeof buf) goto err; if(!SSL_add_file_cert_subjects_to_stack(stack,buf)) goto err; } ret = 1; err: CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); return ret; } ssl/ssl_cert.c:741: error: RESOURCE_LEAK resource acquired by call to `opendir()` at line 718, column 6 is not released after line 741, column 17. Showing all 23 steps of the trace ssl/ssl_cert.c:710:1: start of procedure SSL_add_dir_cert_subjects_to_stack() 708. #ifndef MAC_OS_pre_X 709. 710. > int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, 711. const char *dir) 712. { ssl/ssl_cert.c:715:2: 713. DIR *d; 714. struct dirent *dstruct; 715. > int ret = 0; 716. 717. CRYPTO_w_lock(CRYPTO_LOCK_READDIR); ssl/ssl_cert.c:717:2: 715. int ret = 0; 716. 717. > CRYPTO_w_lock(CRYPTO_LOCK_READDIR); 718. d = opendir(dir); 719. crypto/cryptlib.c:198:1: start of procedure CRYPTO_lock() 196. } 197. 198. > void CRYPTO_lock(int mode, int type, const char *file, int line) 199. { 200. #ifdef LOCK_DEBUG crypto/cryptlib.c:223:6: Taking true branch 221. } 222. #endif 223. if (locking_callback != NULL) ^ 224. locking_callback(mode,type,file,line); 225. } crypto/cryptlib.c:224:3: Skipping __function_pointer__(): unresolved function pointer 222. #endif 223. if (locking_callback != NULL) 224. locking_callback(mode,type,file,line); ^ 225. } 226. crypto/cryptlib.c:223:2: 221. } 222. #endif 223. > if (locking_callback != NULL) 224. locking_callback(mode,type,file,line); 225. } crypto/cryptlib.c:225:2: return from a call to CRYPTO_lock 223. if (locking_callback != NULL) 224. locking_callback(mode,type,file,line); 225. } ^ 226. 227. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, ssl/ssl_cert.c:718:2: 716. 717. CRYPTO_w_lock(CRYPTO_LOCK_READDIR); 718. > d = opendir(dir); 719. 720. /* Note that a side effect is that the CAs will be sorted by name */ ssl/ssl_cert.c:721:6: Taking false branch 719. 720. /* Note that a side effect is that the CAs will be sorted by name */ 721. if(!d) ^ 722. { 723. SYSerr(SYS_F_OPENDIR, get_last_sys_error()); ssl/ssl_cert.c:729:9: Loop condition is true. Entering loop body 727. } 728. 729. while((dstruct=readdir(d))) ^ 730. { 731. char buf[1024]; ssl/ssl_cert.c:734:6: Taking false branch 732. int r; 733. 734. if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf) ^ 735. { 736. SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG); ssl/ssl_cert.c:740:3: 738. } 739. 740. > r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name); 741. if (r <= 0 || r >= sizeof buf) 742. goto err; crypto/bio/b_print.c:849:1: start of procedure BIO_snprintf() 847. * to BIO_printf, and we need *some* name prefix ... 848. * (XXX the function should be renamed, but to what?) */ 849. > int BIO_snprintf(char *buf, size_t n, const char *format, ...) 850. { 851. va_list args; crypto/bio/b_print.c:855:2: 853. int truncated; 854. 855. > va_start(args, format); 856. _dopr(dopr_outch, dopr_isbig, dopr_copy, 857. &buf, &n, &retlen, &truncated, format, args); crypto/bio/b_print.c:856:2: Skipping _dopr(): empty list of specs 854. 855. va_start(args, format); 856. _dopr(dopr_outch, dopr_isbig, dopr_copy, ^ 857. &buf, &n, &retlen, &truncated, format, args); 858. if (truncated) crypto/bio/b_print.c:858:6: Taking false branch 856. _dopr(dopr_outch, dopr_isbig, dopr_copy, 857. &buf, &n, &retlen, &truncated, format, args); 858. if (truncated) ^ 859. /* In case of truncation, return -1 like traditional snprintf. 860. * (Current drafts for ISO/IEC 9899 say snprintf should return crypto/bio/b_print.c:865:11: Condition is true 863. return -1; 864. else 865. return (retlen <= INT_MAX) ? retlen : -1; ^ 866. } crypto/bio/b_print.c:865:10: 863. return -1; 864. else 865. > return (retlen <= INT_MAX) ? retlen : -1; 866. } crypto/bio/b_print.c:865:3: 863. return -1; 864. else 865. > return (retlen <= INT_MAX) ? retlen : -1; 866. } crypto/bio/b_print.c:866:2: return from a call to BIO_snprintf 864. else 865. return (retlen <= INT_MAX) ? retlen : -1; 866. } ^ ssl/ssl_cert.c:741:7: Taking false branch 739. 740. r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name); 741. if (r <= 0 || r >= sizeof buf) ^ 742. goto err; 743. if(!SSL_add_file_cert_subjects_to_stack(stack,buf)) ssl/ssl_cert.c:741:17: Taking true branch 739. 740. r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name); 741. if (r <= 0 || r >= sizeof buf) ^ 742. goto err; 743. if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
https://github.com/openssl/openssl/blob/4d29312ce198d00a69c4b0bf572c0de46778ecc9/ssl/ssl_cert.c/#L741
d2a_code_trace_data_44957
static int parse_ffconfig(const char *filename) { FILE *f; char line[1024]; char cmd[64]; char arg[1024]; const char *p; int val, errors, line_num; FFStream **last_stream, *stream, *redirect; FFStream **last_feed, *feed; AVCodecContext audio_enc, video_enc; int audio_id, video_id; f = fopen(filename, "r"); if (!f) { perror(filename); return -1; } errors = 0; line_num = 0; first_stream = NULL; last_stream = &first_stream; first_feed = NULL; last_feed = &first_feed; stream = NULL; feed = NULL; redirect = NULL; audio_id = CODEC_ID_NONE; video_id = CODEC_ID_NONE; for(;;) { if (fgets(line, sizeof(line), f) == NULL) break; line_num++; p = line; while (isspace(*p)) p++; if (*p == '\0' || *p == '#') continue; get_arg(cmd, sizeof(cmd), &p); if (!strcasecmp(cmd, "Port")) { get_arg(arg, sizeof(arg), &p); val = atoi(arg); if (val < 1 || val > 65536) { fprintf(stderr, "%s:%d: Invalid port: %s\n", filename, line_num, arg); errors++; } my_http_addr.sin_port = htons(val); } else if (!strcasecmp(cmd, "BindAddress")) { get_arg(arg, sizeof(arg), &p); if (resolve_host(&my_http_addr.sin_addr, arg) != 0) { fprintf(stderr, "%s:%d: Invalid host/IP address: %s\n", filename, line_num, arg); errors++; } } else if (!strcasecmp(cmd, "NoDaemon")) { ffserver_daemon = 0; } else if (!strcasecmp(cmd, "RTSPPort")) { get_arg(arg, sizeof(arg), &p); val = atoi(arg); if (val < 1 || val > 65536) { fprintf(stderr, "%s:%d: Invalid port: %s\n", filename, line_num, arg); errors++; } my_rtsp_addr.sin_port = htons(atoi(arg)); } else if (!strcasecmp(cmd, "RTSPBindAddress")) { get_arg(arg, sizeof(arg), &p); if (resolve_host(&my_rtsp_addr.sin_addr, arg) != 0) { fprintf(stderr, "%s:%d: Invalid host/IP address: %s\n", filename, line_num, arg); errors++; } } else if (!strcasecmp(cmd, "MaxClients")) { get_arg(arg, sizeof(arg), &p); val = atoi(arg); if (val < 1 || val > HTTP_MAX_CONNECTIONS) { fprintf(stderr, "%s:%d: Invalid MaxClients: %s\n", filename, line_num, arg); errors++; } else { nb_max_connections = val; } } else if (!strcasecmp(cmd, "MaxBandwidth")) { get_arg(arg, sizeof(arg), &p); val = atoi(arg); if (val < 10 || val > 100000) { fprintf(stderr, "%s:%d: Invalid MaxBandwidth: %s\n", filename, line_num, arg); errors++; } else max_bandwidth = val; } else if (!strcasecmp(cmd, "CustomLog")) { get_arg(logfilename, sizeof(logfilename), &p); } else if (!strcasecmp(cmd, "<Feed")) { char *q; if (stream || feed) { fprintf(stderr, "%s:%d: Already in a tag\n", filename, line_num); } else { feed = av_mallocz(sizeof(FFStream)); *last_stream = feed; last_stream = &feed->next; *last_feed = feed; last_feed = &feed->next_feed; get_arg(feed->filename, sizeof(feed->filename), &p); q = strrchr(feed->filename, '>'); if (*q) *q = '\0'; feed->fmt = guess_format("ffm", NULL, NULL); snprintf(feed->feed_filename, sizeof(feed->feed_filename), "/tmp/%s.ffm", feed->filename); feed->feed_max_size = 5 * 1024 * 1024; feed->is_feed = 1; feed->feed = feed; } } else if (!strcasecmp(cmd, "Launch")) { if (feed) { int i; feed->child_argv = av_mallocz(64 * sizeof(char *)); for (i = 0; i < 62; i++) { get_arg(arg, sizeof(arg), &p); if (!arg[0]) break; feed->child_argv[i] = av_strdup(arg); } feed->child_argv[i] = av_malloc(30 + strlen(feed->filename)); snprintf(feed->child_argv[i], 30+strlen(feed->filename), "http://%s:%d/%s", (my_http_addr.sin_addr.s_addr == INADDR_ANY) ? "127.0.0.1" : inet_ntoa(my_http_addr.sin_addr), ntohs(my_http_addr.sin_port), feed->filename); if (ffserver_debug) { int j; fprintf(stdout, "Launch commandline: "); for (j = 0; j <= i; j++) fprintf(stdout, "%s ", feed->child_argv[j]); fprintf(stdout, "\n"); } } } else if (!strcasecmp(cmd, "ReadOnlyFile")) { if (feed) { get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p); feed->readonly = 1; } else if (stream) { get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p); } } else if (!strcasecmp(cmd, "File")) { if (feed) { get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p); } else if (stream) get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p); } else if (!strcasecmp(cmd, "FileMaxSize")) { if (feed) { char *p1; double fsize; get_arg(arg, sizeof(arg), &p); p1 = arg; fsize = strtod(p1, &p1); switch(toupper(*p1)) { case 'K': fsize *= 1024; break; case 'M': fsize *= 1024 * 1024; break; case 'G': fsize *= 1024 * 1024 * 1024; break; } feed->feed_max_size = (int64_t)fsize; } } else if (!strcasecmp(cmd, "</Feed>")) { if (!feed) { fprintf(stderr, "%s:%d: No corresponding <Feed> for </Feed>\n", filename, line_num); errors++; } feed = NULL; } else if (!strcasecmp(cmd, "<Stream")) { char *q; if (stream || feed) { fprintf(stderr, "%s:%d: Already in a tag\n", filename, line_num); } else { stream = av_mallocz(sizeof(FFStream)); *last_stream = stream; last_stream = &stream->next; get_arg(stream->filename, sizeof(stream->filename), &p); q = strrchr(stream->filename, '>'); if (*q) *q = '\0'; stream->fmt = guess_stream_format(NULL, stream->filename, NULL); memset(&audio_enc, 0, sizeof(AVCodecContext)); memset(&video_enc, 0, sizeof(AVCodecContext)); audio_id = CODEC_ID_NONE; video_id = CODEC_ID_NONE; if (stream->fmt) { audio_id = stream->fmt->audio_codec; video_id = stream->fmt->video_codec; } } } else if (!strcasecmp(cmd, "Feed")) { get_arg(arg, sizeof(arg), &p); if (stream) { FFStream *sfeed; sfeed = first_feed; while (sfeed != NULL) { if (!strcmp(sfeed->filename, arg)) break; sfeed = sfeed->next_feed; } if (!sfeed) fprintf(stderr, "%s:%d: feed '%s' not defined\n", filename, line_num, arg); else stream->feed = sfeed; } } else if (!strcasecmp(cmd, "Format")) { get_arg(arg, sizeof(arg), &p); if (!strcmp(arg, "status")) { stream->stream_type = STREAM_TYPE_STATUS; stream->fmt = NULL; } else { stream->stream_type = STREAM_TYPE_LIVE; if (!strcmp(arg, "jpeg")) strcpy(arg, "mjpeg"); stream->fmt = guess_stream_format(arg, NULL, NULL); if (!stream->fmt) { fprintf(stderr, "%s:%d: Unknown Format: %s\n", filename, line_num, arg); errors++; } } if (stream->fmt) { audio_id = stream->fmt->audio_codec; video_id = stream->fmt->video_codec; } } else if (!strcasecmp(cmd, "InputFormat")) { get_arg(arg, sizeof(arg), &p); stream->ifmt = av_find_input_format(arg); if (!stream->ifmt) { fprintf(stderr, "%s:%d: Unknown input format: %s\n", filename, line_num, arg); } } else if (!strcasecmp(cmd, "FaviconURL")) { if (stream && stream->stream_type == STREAM_TYPE_STATUS) { get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p); } else { fprintf(stderr, "%s:%d: FaviconURL only permitted for status streams\n", filename, line_num); errors++; } } else if (!strcasecmp(cmd, "Author")) { if (stream) get_arg(stream->author, sizeof(stream->author), &p); } else if (!strcasecmp(cmd, "Comment")) { if (stream) get_arg(stream->comment, sizeof(stream->comment), &p); } else if (!strcasecmp(cmd, "Copyright")) { if (stream) get_arg(stream->copyright, sizeof(stream->copyright), &p); } else if (!strcasecmp(cmd, "Title")) { if (stream) get_arg(stream->title, sizeof(stream->title), &p); } else if (!strcasecmp(cmd, "Preroll")) { get_arg(arg, sizeof(arg), &p); if (stream) stream->prebuffer = atof(arg) * 1000; } else if (!strcasecmp(cmd, "StartSendOnKey")) { if (stream) stream->send_on_key = 1; } else if (!strcasecmp(cmd, "AudioCodec")) { get_arg(arg, sizeof(arg), &p); audio_id = opt_audio_codec(arg); if (audio_id == CODEC_ID_NONE) { fprintf(stderr, "%s:%d: Unknown AudioCodec: %s\n", filename, line_num, arg); errors++; } } else if (!strcasecmp(cmd, "VideoCodec")) { get_arg(arg, sizeof(arg), &p); video_id = opt_video_codec(arg); if (video_id == CODEC_ID_NONE) { fprintf(stderr, "%s:%d: Unknown VideoCodec: %s\n", filename, line_num, arg); errors++; } } else if (!strcasecmp(cmd, "MaxTime")) { get_arg(arg, sizeof(arg), &p); if (stream) stream->max_time = atof(arg) * 1000; } else if (!strcasecmp(cmd, "AudioBitRate")) { get_arg(arg, sizeof(arg), &p); if (stream) audio_enc.bit_rate = atoi(arg) * 1000; } else if (!strcasecmp(cmd, "AudioChannels")) { get_arg(arg, sizeof(arg), &p); if (stream) audio_enc.channels = atoi(arg); } else if (!strcasecmp(cmd, "AudioSampleRate")) { get_arg(arg, sizeof(arg), &p); if (stream) audio_enc.sample_rate = atoi(arg); } else if (!strcasecmp(cmd, "AudioQuality")) { get_arg(arg, sizeof(arg), &p); if (stream) { } } else if (!strcasecmp(cmd, "VideoBitRateRange")) { if (stream) { int minrate, maxrate; get_arg(arg, sizeof(arg), &p); if (sscanf(arg, "%d-%d", &minrate, &maxrate) == 2) { video_enc.rc_min_rate = minrate * 1000; video_enc.rc_max_rate = maxrate * 1000; } else { fprintf(stderr, "%s:%d: Incorrect format for VideoBitRateRange -- should be <min>-<max>: %s\n", filename, line_num, arg); errors++; } } } else if (!strcasecmp(cmd, "Debug")) { if (stream) { get_arg(arg, sizeof(arg), &p); video_enc.debug = strtol(arg,0,0); } } else if (!strcasecmp(cmd, "Strict")) { if (stream) { get_arg(arg, sizeof(arg), &p); video_enc.strict_std_compliance = atoi(arg); } } else if (!strcasecmp(cmd, "VideoBufferSize")) { if (stream) { get_arg(arg, sizeof(arg), &p); video_enc.rc_buffer_size = atoi(arg) * 8*1024; } } else if (!strcasecmp(cmd, "VideoBitRateTolerance")) { if (stream) { get_arg(arg, sizeof(arg), &p); video_enc.bit_rate_tolerance = atoi(arg) * 1000; } } else if (!strcasecmp(cmd, "VideoBitRate")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.bit_rate = atoi(arg) * 1000; } } else if (!strcasecmp(cmd, "VideoSize")) { get_arg(arg, sizeof(arg), &p); if (stream) { av_parse_video_frame_size(&video_enc.width, &video_enc.height, arg); if ((video_enc.width % 16) != 0 || (video_enc.height % 16) != 0) { fprintf(stderr, "%s:%d: Image size must be a multiple of 16\n", filename, line_num); errors++; } } } else if (!strcasecmp(cmd, "VideoFrameRate")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.time_base.num= DEFAULT_FRAME_RATE_BASE; video_enc.time_base.den = (int)(strtod(arg, NULL) * video_enc.time_base.num); } } else if (!strcasecmp(cmd, "VideoGopSize")) { get_arg(arg, sizeof(arg), &p); if (stream) video_enc.gop_size = atoi(arg); } else if (!strcasecmp(cmd, "VideoIntraOnly")) { if (stream) video_enc.gop_size = 1; } else if (!strcasecmp(cmd, "VideoHighQuality")) { if (stream) video_enc.mb_decision = FF_MB_DECISION_BITS; } else if (!strcasecmp(cmd, "Video4MotionVector")) { if (stream) { video_enc.mb_decision = FF_MB_DECISION_BITS; video_enc.flags |= CODEC_FLAG_4MV; } } else if (!strcasecmp(cmd, "VideoTag")) { get_arg(arg, sizeof(arg), &p); if ((strlen(arg) == 4) && stream) video_enc.codec_tag = ff_get_fourcc(arg); } else if (!strcasecmp(cmd, "BitExact")) { if (stream) video_enc.flags |= CODEC_FLAG_BITEXACT; } else if (!strcasecmp(cmd, "DctFastint")) { if (stream) video_enc.dct_algo = FF_DCT_FASTINT; } else if (!strcasecmp(cmd, "IdctSimple")) { if (stream) video_enc.idct_algo = FF_IDCT_SIMPLE; } else if (!strcasecmp(cmd, "Qscale")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.flags |= CODEC_FLAG_QSCALE; video_enc.global_quality = FF_QP2LAMBDA * atoi(arg); } } else if (!strcasecmp(cmd, "VideoQDiff")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.max_qdiff = atoi(arg); if (video_enc.max_qdiff < 1 || video_enc.max_qdiff > 31) { fprintf(stderr, "%s:%d: VideoQDiff out of range\n", filename, line_num); errors++; } } } else if (!strcasecmp(cmd, "VideoQMax")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.qmax = atoi(arg); if (video_enc.qmax < 1 || video_enc.qmax > 31) { fprintf(stderr, "%s:%d: VideoQMax out of range\n", filename, line_num); errors++; } } } else if (!strcasecmp(cmd, "VideoQMin")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.qmin = atoi(arg); if (video_enc.qmin < 1 || video_enc.qmin > 31) { fprintf(stderr, "%s:%d: VideoQMin out of range\n", filename, line_num); errors++; } } } else if (!strcasecmp(cmd, "LumaElim")) { get_arg(arg, sizeof(arg), &p); if (stream) video_enc.luma_elim_threshold = atoi(arg); } else if (!strcasecmp(cmd, "ChromaElim")) { get_arg(arg, sizeof(arg), &p); if (stream) video_enc.chroma_elim_threshold = atoi(arg); } else if (!strcasecmp(cmd, "LumiMask")) { get_arg(arg, sizeof(arg), &p); if (stream) video_enc.lumi_masking = atof(arg); } else if (!strcasecmp(cmd, "DarkMask")) { get_arg(arg, sizeof(arg), &p); if (stream) video_enc.dark_masking = atof(arg); } else if (!strcasecmp(cmd, "NoVideo")) { video_id = CODEC_ID_NONE; } else if (!strcasecmp(cmd, "NoAudio")) { audio_id = CODEC_ID_NONE; } else if (!strcasecmp(cmd, "ACL")) { IPAddressACL acl; get_arg(arg, sizeof(arg), &p); if (strcasecmp(arg, "allow") == 0) acl.action = IP_ALLOW; else if (strcasecmp(arg, "deny") == 0) acl.action = IP_DENY; else { fprintf(stderr, "%s:%d: ACL action '%s' is not ALLOW or DENY\n", filename, line_num, arg); errors++; } get_arg(arg, sizeof(arg), &p); if (resolve_host(&acl.first, arg) != 0) { fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n", filename, line_num, arg); errors++; } else acl.last = acl.first; get_arg(arg, sizeof(arg), &p); if (arg[0]) { if (resolve_host(&acl.last, arg) != 0) { fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n", filename, line_num, arg); errors++; } } if (!errors) { IPAddressACL *nacl = av_mallocz(sizeof(*nacl)); IPAddressACL **naclp = 0; acl.next = 0; *nacl = acl; if (stream) naclp = &stream->acl; else if (feed) naclp = &feed->acl; else { fprintf(stderr, "%s:%d: ACL found not in <stream> or <feed>\n", filename, line_num); errors++; } if (naclp) { while (*naclp) naclp = &(*naclp)->next; *naclp = nacl; } } } else if (!strcasecmp(cmd, "RTSPOption")) { get_arg(arg, sizeof(arg), &p); if (stream) { av_freep(&stream->rtsp_option); stream->rtsp_option = av_strdup(arg); } } else if (!strcasecmp(cmd, "MulticastAddress")) { get_arg(arg, sizeof(arg), &p); if (stream) { if (resolve_host(&stream->multicast_ip, arg) != 0) { fprintf(stderr, "%s:%d: Invalid host/IP address: %s\n", filename, line_num, arg); errors++; } stream->is_multicast = 1; stream->loop = 1; } } else if (!strcasecmp(cmd, "MulticastPort")) { get_arg(arg, sizeof(arg), &p); if (stream) stream->multicast_port = atoi(arg); } else if (!strcasecmp(cmd, "MulticastTTL")) { get_arg(arg, sizeof(arg), &p); if (stream) stream->multicast_ttl = atoi(arg); } else if (!strcasecmp(cmd, "NoLoop")) { if (stream) stream->loop = 0; } else if (!strcasecmp(cmd, "</Stream>")) { if (!stream) { fprintf(stderr, "%s:%d: No corresponding <Stream> for </Stream>\n", filename, line_num); errors++; } if (stream->feed && stream->fmt && strcmp(stream->fmt->name, "ffm") != 0) { if (audio_id != CODEC_ID_NONE) { audio_enc.codec_type = CODEC_TYPE_AUDIO; audio_enc.codec_id = audio_id; add_codec(stream, &audio_enc); } if (video_id != CODEC_ID_NONE) { video_enc.codec_type = CODEC_TYPE_VIDEO; video_enc.codec_id = video_id; add_codec(stream, &video_enc); } } stream = NULL; } else if (!strcasecmp(cmd, "<Redirect")) { char *q; if (stream || feed || redirect) { fprintf(stderr, "%s:%d: Already in a tag\n", filename, line_num); errors++; } else { redirect = av_mallocz(sizeof(FFStream)); *last_stream = redirect; last_stream = &redirect->next; get_arg(redirect->filename, sizeof(redirect->filename), &p); q = strrchr(redirect->filename, '>'); if (*q) *q = '\0'; redirect->stream_type = STREAM_TYPE_REDIRECT; } } else if (!strcasecmp(cmd, "URL")) { if (redirect) get_arg(redirect->feed_filename, sizeof(redirect->feed_filename), &p); } else if (!strcasecmp(cmd, "</Redirect>")) { if (!redirect) { fprintf(stderr, "%s:%d: No corresponding <Redirect> for </Redirect>\n", filename, line_num); errors++; } if (!redirect->feed_filename[0]) { fprintf(stderr, "%s:%d: No URL found for <Redirect>\n", filename, line_num); errors++; } redirect = NULL; } else if (!strcasecmp(cmd, "LoadModule")) { get_arg(arg, sizeof(arg), &p); #ifdef HAVE_DLOPEN load_module(arg); #else fprintf(stderr, "%s:%d: Module support not compiled into this version: '%s'\n", filename, line_num, arg); errors++; #endif } else { fprintf(stderr, "%s:%d: Incorrect keyword: '%s'\n", filename, line_num, cmd); errors++; } } fclose(f); if (errors) return -1; else return 0; } ffserver.c:4075: error: Uninitialized Value The value read from video_enc.flags was never initialized. ffserver.c:4075:17: 4073. if (stream) { 4074. video_enc.mb_decision = FF_MB_DECISION_BITS; //FIXME remove 4075. video_enc.flags |= CODEC_FLAG_4MV; ^ 4076. } 4077. } else if (!strcasecmp(cmd, "VideoTag")) {
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/ffserver.c/#L4075
d2a_code_trace_data_44958
int BN_sub_word(BIGNUM *a, BN_ULONG w) { int i; bn_check_top(a); w &= BN_MASK2; if (!w) return 1; if (BN_is_zero(a)) { i = BN_set_word(a, w); if (i != 0) BN_set_negative(a, 1); return i; } if (a->neg) { a->neg = 0; i = BN_add_word(a, w); a->neg = 1; return (i); } if ((a->top == 1) && (a->d[0] < w)) { a->d[0] = w - a->d[0]; a->neg = 1; return (1); } i = 0; for (;;) { if (a->d[i] >= w) { a->d[i] -= w; break; } else { a->d[i] = (a->d[i] - w) & BN_MASK2; i++; w = 1; } } if ((a->d[i] == 0) && (i == (a->top - 1))) a->top--; bn_check_top(a); return (1); } crypto/dh/dh_check.c:41: error: BUFFER_OVERRUN_L3 Offset: 0 Size: [0, 8388607] by call to `BN_sub_word`. Showing all 9 steps of the trace crypto/dh/dh_check.c:33:11: Call 31. goto err; 32. BN_CTX_start(ctx); 33. tmp = BN_CTX_get(ctx); ^ 34. if (tmp == NULL) 35. goto err; crypto/bn/bn_ctx.c:229:5: Call 227. } 228. /* OK, make sure the returned bignum is "zero" */ 229. BN_zero(ret); ^ 230. ctx->used++; 231. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:463:1: Parameter `*a->d` 461. } 462. 463. > int BN_set_word(BIGNUM *a, BN_ULONG w) 464. { 465. bn_check_top(a); crypto/bn/bn_lib.c:466:9: Call 464. { 465. bn_check_top(a); 466. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 467. return (0); 468. a->neg = 0; crypto/bn/bn_lcl.h:676:1: Parameter `*a->d` 674. int bn_probable_prime_dh_coprime(BIGNUM *rnd, int bits, BN_CTX *ctx); 675. 676. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 677. { 678. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/dh/dh_check.c:41:41: Call 39. if (BN_is_negative(dh->g) || BN_is_zero(dh->g) || BN_is_one(dh->g)) 40. *ret |= DH_NOT_SUITABLE_GENERATOR; 41. if (BN_copy(tmp, dh->p) == NULL || !BN_sub_word(tmp, 1)) ^ 42. goto err; 43. if (BN_cmp(dh->g, tmp) >= 0) crypto/bn/bn_word.c:132:1: <Length trace> 130. } 131. 132. > int BN_sub_word(BIGNUM *a, BN_ULONG w) 133. { 134. int i; crypto/bn/bn_word.c:132:1: Parameter `*a->d` 130. } 131. 132. > int BN_sub_word(BIGNUM *a, BN_ULONG w) 133. { 134. int i; crypto/bn/bn_word.c:157:27: Array access: Offset: 0 Size: [0, 8388607] by call to `BN_sub_word` 155. } 156. 157. if ((a->top == 1) && (a->d[0] < w)) { ^ 158. a->d[0] = w - a->d[0]; 159. a->neg = 1;
https://github.com/openssl/openssl/blob/6f8950a3cc466a7e2660dd9d7c8e9d11f47643ed/crypto/bn/bn_word.c/#L157
d2a_code_trace_data_44959
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); } apps/x509.c:749: error: BUFFER_OVERRUN_L3 Offset: [-529, +oo] Size: 12 by call to `ASN1_TIME_print`. Showing all 11 steps of the trace apps/x509.c:610:9: Call 608. 609. X509_get0_signature(&signature, NULL, x); 610. corrupt_signature(signature); ^ 611. } 612. apps/apps.c:2587:1: Parameter `*signature->data` 2585. 2586. /* Corrupt a signature by modifying final byte */ 2587. > void corrupt_signature(const ASN1_STRING *signature) 2588. { 2589. unsigned char *s = signature->data; apps/x509.c:749:17: Call 747. } else if (startdate == i) { 748. BIO_puts(out, "notBefore="); 749. ASN1_TIME_print(out, X509_get0_notBefore(x)); ^ 750. BIO_puts(out, "\n"); 751. } else if (enddate == i) { crypto/asn1/a_time.c:155:1: Parameter `*tm->data` 153. } 154. 155. > int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm) 156. { 157. if (tm->type == V_ASN1_UTCTIME) crypto/asn1/a_time.c:160:16: Call 158. return ASN1_UTCTIME_print(bp, tm); 159. if (tm->type == V_ASN1_GENERALIZEDTIME) 160. return ASN1_GENERALIZEDTIME_print(bp, tm); ^ 161. BIO_write(bp, "Bad time value", 14); 162. return (0); crypto/asn1/a_gentm.c:224:1: <Offset trace> 222. }; 223. 224. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 225. { 226. char *v; crypto/asn1/a_gentm.c:224:1: Parameter `*tm->data` 222. }; 223. 224. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 225. { 226. char *v; crypto/asn1/a_gentm.c:245:5: Assignment 243. y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 244. + (v[2] - '0') * 10 + (v[3] - '0'); 245. M = (v[4] - '0') * 10 + (v[5] - '0'); ^ 246. if ((M > 12) || (M < 1)) 247. goto err; crypto/asn1/a_gentm.c:219:1: <Length trace> 217. } 218. 219. > const char *_asn1_mon[12] = { 220. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 221. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/a_gentm.c:219:1: Array declaration 217. } 218. 219. > const char *_asn1_mon[12] = { 220. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 221. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/a_gentm.c:266:20: Array access: Offset: [-529, +oo] Size: 12 by call to `ASN1_TIME_print` 264. 265. if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", 266. _asn1_mon[M - 1], d, h, m, s, f_len, f, y, ^ 267. (gmt) ? " GMT" : "") <= 0) 268. return (0);
https://github.com/openssl/openssl/blob/5a7ad1f08bfccbdad0f20920f9c284bba036fb70/crypto/asn1/a_gentm.c/#L266
d2a_code_trace_data_44960
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: [33+min(0, `c->synth_buf_offset[*]`), 48+max(511, `c->synth_buf_offset[*]`)] 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:906:9: <Length trace> 904. /* we calculate two samples at the same time to avoid one memory 905. access per two sample */ 906. for(j=1;j<16;j++) { ^ 907. sum2 = 0; 908. p = synth_buf + 16 + j; libavcodec/mpegaudiodec.c:906:9: Assignment 904. /* we calculate two samples at the same time to avoid one memory 905. access per two sample */ 906. for(j=1;j<16;j++) { ^ 907. sum2 = 0; 908. p = synth_buf + 16 + j; libavcodec/mpegaudiodec.c:910:9: Assignment 908. p = synth_buf + 16 + j; 909. SUM8P2(sum, +=, sum2, -=, w, w2, p); 910. p = synth_buf + 48 - j; ^ 911. SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p); 912. libavcodec/mpegaudiodec.c:911:9: Array access: Offset: [33+min(0, c->synth_buf_offset[*]), 48+max(511, c->synth_buf_offset[*])] Size: 2 by call to `ff_mpa_synth_filter` 909. SUM8P2(sum, +=, sum2, -=, w, w2, p); 910. p = synth_buf + 48 - j; 911. SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p); ^ 912. 913. *samples = round_sample(&sum);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L911
d2a_code_trace_data_44961
int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl) { int i, j; size_t total = 0; *outl = 0; if (inl <= 0) return 0; OPENSSL_assert(ctx->length <= (int)sizeof(ctx->enc_data)); if (ctx->length - ctx->num > inl) { memcpy(&(ctx->enc_data[ctx->num]), in, inl); ctx->num += inl; return 1; } if (ctx->num != 0) { i = ctx->length - ctx->num; memcpy(&(ctx->enc_data[ctx->num]), in, i); in += i; inl -= i; j = evp_encodeblock_int(ctx, out, ctx->enc_data, ctx->length); ctx->num = 0; out += j; total = j; if ((ctx->flags & EVP_ENCODE_CTX_NO_NEWLINES) == 0) { *(out++) = '\n'; total++; } *out = '\0'; } while (inl >= ctx->length && total <= INT_MAX) { j = evp_encodeblock_int(ctx, out, in, ctx->length); in += ctx->length; inl -= ctx->length; out += j; total += j; if ((ctx->flags & EVP_ENCODE_CTX_NO_NEWLINES) == 0) { *(out++) = '\n'; total++; } *out = '\0'; } if (total > INT_MAX) { *outl = 0; return 0; } if (inl != 0) memcpy(&(ctx->enc_data[0]), in, inl); ctx->num = inl; *outl = total; return 1; } crypto/srp/srp_vfy.c:145: error: BUFFER_OVERRUN_L1 Offset added: [48, 80] Size: 16 by call to `EVP_EncodeUpdate`. Showing all 8 steps of the trace crypto/srp/srp_vfy.c:124:1: Array declaration 122. * Returns 1 on success or 0 on error. 123. */ 124. > static int t_tob64(char *dst, const unsigned char *src, int size) 125. { 126. EVP_ENCODE_CTX *ctx = EVP_ENCODE_CTX_new(); crypto/srp/srp_vfy.c:145:17: Call 143. leadz = 3 - (size % 3); 144. if (leadz != 3 145. && !EVP_EncodeUpdate(ctx, (unsigned char *)dst, &outl, pad, ^ 146. leadz)) { 147. EVP_ENCODE_CTX_free(ctx); crypto/evp/encode.c:162:1: <Offset trace> 160. } 161. 162. > int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, 163. const unsigned char *in, int inl) 164. { crypto/evp/encode.c:162:1: Parameter `inl` 160. } 161. 162. > int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, 163. const unsigned char *in, int inl) 164. { crypto/evp/encode.c:178:9: Assignment 176. } 177. if (ctx->num != 0) { 178. i = ctx->length - ctx->num; ^ 179. memcpy(&(ctx->enc_data[ctx->num]), in, i); 180. in += i; crypto/evp/encode.c:162:1: <Length trace> 160. } 161. 162. > int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, 163. const unsigned char *in, int inl) 164. { crypto/evp/encode.c:162:1: Parameter `*in` 160. } 161. 162. > int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, 163. const unsigned char *in, int inl) 164. { crypto/evp/encode.c:179:9: Array access: Offset added: [48, 80] Size: 16 by call to `EVP_EncodeUpdate` 177. if (ctx->num != 0) { 178. i = ctx->length - ctx->num; 179. memcpy(&(ctx->enc_data[ctx->num]), in, i); ^ 180. in += i; 181. inl -= i;
https://github.com/openssl/openssl/blob/a8ca496ddb532d7f7dc356fd2b026697388d2384/crypto/evp/encode.c/#L179
d2a_code_trace_data_44962
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:354: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_nnmod`. Showing all 21 steps of the trace crypto/bn/bn_exp.c:349:14: Call 347. if ((mont = BN_MONT_CTX_new()) == NULL) 348. goto err; 349. if (!BN_MONT_CTX_set(mont, m, ctx)) ^ 350. goto err; 351. } crypto/bn/bn_mont.c:353:14: Call 351. else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) 352. goto err; 353. if (!BN_lshift(Ri, Ri, BN_BITS2)) ^ 354. goto err; /* R*Ri */ 355. if (!BN_is_zero(Ri)) { crypto/bn/bn_shift.c:84:1: Parameter `r->top` 82. } 83. 84. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 85. { 86. int ret; crypto/bn/bn_exp.c:354:14: Call 352. 353. if (a->neg || BN_ucmp(a, m) >= 0) { 354. if (!BN_nnmod(val[0], a, m, ctx)) ^ 355. goto err; 356. aa = val[0]; crypto/bn/bn_mod.c:13:1: Parameter `*r->d` 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->d` 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->d` 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->d` 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:239:19: Call 237. mask |= mask >> 8; 238. top = a->top - nw; 239. if (r != a && bn_wexpand(r, top) == NULL) ^ 240. return 0; 241. 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, 536870848] by call to `BN_nnmod` 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_44963
int RAND_pseudo_bytes(unsigned char *buf, int num) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->pseudorand != NULL) return meth->pseudorand(buf, num); return -1; } crypto/rand/rand_lib.c:909: error: NULL_DEREFERENCE pointer `meth` last assigned on line 907 could be null and is dereferenced at line 909, column 9. Showing all 6 steps of the trace crypto/rand/rand_lib.c:905:1: start of procedure RAND_pseudo_bytes() 903. 904. #if !OPENSSL_API_1_1_0 && !defined(FIPS_MODE) 905. > int RAND_pseudo_bytes(unsigned char *buf, int num) 906. { 907. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:907:5: 905. int RAND_pseudo_bytes(unsigned char *buf, int num) 906. { 907. > const RAND_METHOD *meth = RAND_get_rand_method(); 908. 909. if (meth->pseudorand != NULL) crypto/rand/rand_lib.c:775:1: start of procedure RAND_get_rand_method() 773. #endif 774. 775. > const RAND_METHOD *RAND_get_rand_method(void) 776. { 777. #ifdef FIPS_MODE crypto/rand/rand_lib.c:778:5: 776. { 777. #ifdef FIPS_MODE 778. > return NULL; 779. #else 780. const RAND_METHOD *tmp_meth = NULL; crypto/rand/rand_lib.c:807:1: return from a call to RAND_get_rand_method 805. return tmp_meth; 806. #endif 807. > } 808. 809. #if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) crypto/rand/rand_lib.c:909:9: 907. const RAND_METHOD *meth = RAND_get_rand_method(); 908. 909. > if (meth->pseudorand != NULL) 910. return meth->pseudorand(buf, num); 911. return -1;
https://github.com/openssl/openssl/blob/fa3eb248e29ca8031e6a14e8a2c6f3cd58b5450e/crypto/rand/rand_lib.c/#L909
d2a_code_trace_data_44964
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) { int line_size; int sample_size = av_get_bytes_per_sample(sample_fmt); int planar = av_sample_fmt_is_planar(sample_fmt); if (!sample_size || nb_samples <= 0 || nb_channels <= 0) return AVERROR(EINVAL); if (!align) { if (nb_samples > INT_MAX - 31) return AVERROR(EINVAL); align = 1; nb_samples = FFALIGN(nb_samples, 32); } if (nb_channels > INT_MAX / align || (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size) return AVERROR(EINVAL); line_size = planar ? FFALIGN(nb_samples * sample_size, align) : FFALIGN(nb_samples * sample_size * nb_channels, align); if (linesize) *linesize = line_size; return planar ? line_size * nb_channels : line_size; } libavcodec/dcadec.c:1958: error: Integer Overflow L2 ([1, 2147483616] + 32):signed32 by call to `av_samples_get_buffer_size`. libavcodec/dcadec.c:1735:16: Call 1733. 1734. init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8); 1735. if ((ret = dca_parse_frame_header(s)) < 0) { ^ 1736. //seems like the frame is corrupt, try with the next one 1737. return ret; libavcodec/dcadec.c:570:28: Call 568. s->samples_deficit = get_bits(&s->gb, 5) + 1; 569. s->crc_present = get_bits(&s->gb, 1); 570. s->sample_blocks = get_bits(&s->gb, 7) + 1; ^ 571. s->frame_size = get_bits(&s->gb, 14) + 1; 572. if (s->frame_size < 95) libavcodec/get_bits.h:244:5: Call 242. register int tmp; 243. OPEN_READER(re, s); 244. UPDATE_CACHE(re, s); ^ 245. tmp = SHOW_UBITS(re, s, n); 246. LAST_SKIP_BITS(re, s, n); libavutil/bswap.h:68:1: Parameter `x` 66. 67. #ifndef av_bswap32 68. static av_always_inline av_const uint32_t av_bswap32(uint32_t x) ^ 69. { 70. return AV_BSWAP32C(x); libavutil/bswap.h:70:5: Assignment 68. static av_always_inline av_const uint32_t av_bswap32(uint32_t x) 69. { 70. return AV_BSWAP32C(x); ^ 71. } 72. #endif libavcodec/get_bits.h:244:5: Assignment 242. register int tmp; 243. OPEN_READER(re, s); 244. UPDATE_CACHE(re, s); ^ 245. tmp = SHOW_UBITS(re, s, n); 246. LAST_SKIP_BITS(re, s, n); libavcodec/get_bits.h:245:5: Assignment 243. OPEN_READER(re, s); 244. UPDATE_CACHE(re, s); 245. tmp = SHOW_UBITS(re, s, n); ^ 246. LAST_SKIP_BITS(re, s, n); 247. CLOSE_READER(re, s); libavcodec/get_bits.h:248:5: Assignment 246. LAST_SKIP_BITS(re, s, n); 247. CLOSE_READER(re, s); 248. return tmp; ^ 249. } 250. libavcodec/dcadec.c:570:5: Assignment 568. s->samples_deficit = get_bits(&s->gb, 5) + 1; 569. s->crc_present = get_bits(&s->gb, 1); 570. s->sample_blocks = get_bits(&s->gb, 7) + 1; ^ 571. s->frame_size = get_bits(&s->gb, 14) + 1; 572. if (s->frame_size < 95) libavcodec/dcadec.c:1949:5: Assignment 1947. 1948. /* get output buffer */ 1949. frame->nb_samples = 256 * (s->sample_blocks / 8); ^ 1950. if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { 1951. av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); libavcodec/dcadec.c:1958:15: Call 1956. /* allocate buffer for extra channels if downmixing */ 1957. if (avctx->channels < full_channels) { 1958. ret = av_samples_get_buffer_size(NULL, full_channels - channels, ^ 1959. frame->nb_samples, 1960. avctx->sample_fmt, 0); libavutil/samplefmt.c:108:1: <LHS trace> 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:108:1: Parameter `nb_samples` 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:124:9: Binary operation: ([1, 2147483616] + 32):signed32 by call to `av_samples_get_buffer_size` 122. return AVERROR(EINVAL); 123. align = 1; 124. nb_samples = FFALIGN(nb_samples, 32); ^ 125. } 126.
https://github.com/libav/libav/blob/0e830094ad0dc251613a0aa3234d9c5c397e02e6/libavutil/samplefmt.c/#L124
d2a_code_trace_data_44965
static int encode_test_init(EVP_TEST *t, const char *encoding) { ENCODE_DATA *edata; if (!TEST_ptr(edata = OPENSSL_zalloc(sizeof(*edata)))) return 0; if (strcmp(encoding, "canonical") == 0) { edata->encoding = BASE64_CANONICAL_ENCODING; } else if (strcmp(encoding, "valid") == 0) { edata->encoding = BASE64_VALID_ENCODING; } else if (strcmp(encoding, "invalid") == 0) { edata->encoding = BASE64_INVALID_ENCODING; if (!TEST_ptr(t->expected_err = OPENSSL_strdup("DECODE_ERROR"))) return 0; } else { TEST_error("Bad encoding: %s." " Should be one of {canonical, valid, invalid}", encoding); return 0; } t->data = edata; return 1; } test/evp_test.c:1766: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_zalloc()` at line 1755, column 10 is not reachable after line 1766, column 9. Showing all 28 steps of the trace test/evp_test.c:1751:1: start of procedure encode_test_init() 1749. } ENCODE_DATA; 1750. 1751. > static int encode_test_init(EVP_TEST *t, const char *encoding) 1752. { 1753. ENCODE_DATA *edata; test/evp_test.c:1755:10: 1753. ENCODE_DATA *edata; 1754. 1755. > if (!TEST_ptr(edata = OPENSSL_zalloc(sizeof(*edata)))) 1756. return 0; 1757. if (strcmp(encoding, "canonical") == 0) { crypto/mem.c:228:1: start of procedure CRYPTO_zalloc() 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:5: 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:192:1: start of procedure CRYPTO_malloc() 190. #endif 191. 192. > void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. void *ret = NULL; crypto/mem.c:194:5: 192. void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. > void *ret = NULL; 195. 196. INCREMENT(malloc_count); crypto/mem.c:197:9: Taking false branch 195. 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 198. return malloc_impl(num, file, line); 199. crypto/mem.c:200:9: Taking false branch 198. return malloc_impl(num, file, line); 199. 200. if (num == 0) ^ 201. return NULL; 202. crypto/mem.c:204:9: Taking true branch 202. 203. FAILTEST(); 204. if (allow_customize) { ^ 205. /* 206. * Disallow customization after the first allocation. We only set this crypto/mem.c:210:9: 208. * allocation. 209. */ 210. > allow_customize = 0; 211. } 212. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:221:5: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:221:19: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:222:5: 220. #else 221. (void)(file); (void)(line); 222. > ret = malloc(num); 223. #endif 224. crypto/mem.c:225:5: 223. #endif 224. 225. > return ret; 226. } 227. crypto/mem.c:226:1: return from a call to CRYPTO_malloc 224. 225. return ret; 226. > } 227. 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:233:9: Taking true branch 231. 232. FAILTEST(); 233. if (ret != NULL) ^ 234. memset(ret, 0, num); 235. return ret; crypto/mem.c:234:9: 232. FAILTEST(); 233. if (ret != NULL) 234. > memset(ret, 0, num); 235. return ret; 236. } crypto/mem.c:235:5: 233. if (ret != NULL) 234. memset(ret, 0, num); 235. > return ret; 236. } 237. crypto/mem.c:236:1: return from a call to CRYPTO_zalloc 234. memset(ret, 0, num); 235. return ret; 236. > } 237. 238. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) test/testutil/tests.c:228:1: start of procedure test_ptr() 226. } 227. 228. > int test_ptr(const char *file, int line, const char *s, const void *p) 229. { 230. if (p != NULL) test/testutil/tests.c:230:9: Taking true branch 228. int test_ptr(const char *file, int line, const char *s, const void *p) 229. { 230. if (p != NULL) ^ 231. return 1; 232. test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p); test/testutil/tests.c:231:9: 229. { 230. if (p != NULL) 231. > return 1; 232. test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p); 233. return 0; test/testutil/tests.c:234:1: return from a call to test_ptr 232. test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p); 233. return 0; 234. > } 235. 236. int test_true(const char *file, int line, const char *s, int b) test/evp_test.c:1755:10: Taking false branch 1753. ENCODE_DATA *edata; 1754. 1755. if (!TEST_ptr(edata = OPENSSL_zalloc(sizeof(*edata)))) ^ 1756. return 0; 1757. if (strcmp(encoding, "canonical") == 0) { test/evp_test.c:1757:9: Taking false branch 1755. if (!TEST_ptr(edata = OPENSSL_zalloc(sizeof(*edata)))) 1756. return 0; 1757. if (strcmp(encoding, "canonical") == 0) { ^ 1758. edata->encoding = BASE64_CANONICAL_ENCODING; 1759. } else if (strcmp(encoding, "valid") == 0) { test/evp_test.c:1759:16: Taking false branch 1757. if (strcmp(encoding, "canonical") == 0) { 1758. edata->encoding = BASE64_CANONICAL_ENCODING; 1759. } else if (strcmp(encoding, "valid") == 0) { ^ 1760. edata->encoding = BASE64_VALID_ENCODING; 1761. } else if (strcmp(encoding, "invalid") == 0) { test/evp_test.c:1761:16: Taking false branch 1759. } else if (strcmp(encoding, "valid") == 0) { 1760. edata->encoding = BASE64_VALID_ENCODING; 1761. } else if (strcmp(encoding, "invalid") == 0) { ^ 1762. edata->encoding = BASE64_INVALID_ENCODING; 1763. if (!TEST_ptr(t->expected_err = OPENSSL_strdup("DECODE_ERROR"))) test/evp_test.c:1766:9: 1764. return 0; 1765. } else { 1766. > TEST_error("Bad encoding: %s." 1767. " Should be one of {canonical, valid, invalid}", 1768. encoding);
https://github.com/openssl/openssl/blob/df1f538f28c10f2954757164b17781040d2355ef/test/evp_test.c/#L1766
d2a_code_trace_data_44966
static void copy_parameter_set(void **to, void **from, int count, int size) { int i; for (i = 0; i < count; i++) { if (to[i] && !from[i]) av_freep(&to[i]); else if (from[i] && !to[i]) to[i] = av_malloc(size); if (from[i]) memcpy(to[i], from[i], size); } } libavcodec/h264.c:1617: error: Null Dereference pointer `*to[i]` last assigned on line 1614 could be null and is dereferenced by call to `memcpy()` at line 1617, column 13. libavcodec/h264.c:1606:1: start of procedure copy_parameter_set() 1604. } 1605. 1606. static void copy_parameter_set(void **to, void **from, int count, int size) ^ 1607. { 1608. int i; libavcodec/h264.c:1610:10: 1608. int i; 1609. 1610. for (i = 0; i < count; i++) { ^ 1611. if (to[i] && !from[i]) 1612. av_freep(&to[i]); libavcodec/h264.c:1610:17: Loop condition is true. Entering loop body 1608. int i; 1609. 1610. for (i = 0; i < count; i++) { ^ 1611. if (to[i] && !from[i]) 1612. av_freep(&to[i]); libavcodec/h264.c:1611:13: Taking false branch 1609. 1610. for (i = 0; i < count; i++) { 1611. if (to[i] && !from[i]) ^ 1612. av_freep(&to[i]); 1613. else if (from[i] && !to[i]) libavcodec/h264.c:1613:18: Taking true branch 1611. if (to[i] && !from[i]) 1612. av_freep(&to[i]); 1613. else if (from[i] && !to[i]) ^ 1614. to[i] = av_malloc(size); 1615. libavcodec/h264.c:1613:30: Taking true branch 1611. if (to[i] && !from[i]) 1612. av_freep(&to[i]); 1613. else if (from[i] && !to[i]) ^ 1614. to[i] = av_malloc(size); 1615. libavcodec/h264.c:1614:13: 1612. av_freep(&to[i]); 1613. else if (from[i] && !to[i]) 1614. to[i] = av_malloc(size); ^ 1615. 1616. if (from[i]) libavutil/mem.c:61:1: start of procedure av_malloc() 59. * linker will do it automatically. */ 60. 61. void *av_malloc(size_t size) ^ 62. { 63. void *ptr = NULL; libavutil/mem.c:63:5: 61. void *av_malloc(size_t size) 62. { 63. void *ptr = NULL; ^ 64. #if CONFIG_MEMALIGN_HACK 65. long diff; libavutil/mem.c:69:9: Taking true branch 67. 68. /* let's disallow possible ambiguous cases */ 69. if (size > (INT_MAX - 32) || !size) ^ 70. return NULL; 71. libavutil/mem.c:70:9: 68. /* let's disallow possible ambiguous cases */ 69. if (size > (INT_MAX - 32) || !size) 70. return NULL; ^ 71. 72. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:114:1: return from a call to av_malloc 112. #endif 113. return ptr; 114. } ^ 115. 116. void *av_realloc(void *ptr, size_t size) libavcodec/h264.c:1616:13: Taking true branch 1614. to[i] = av_malloc(size); 1615. 1616. if (from[i]) ^ 1617. memcpy(to[i], from[i], size); 1618. } libavcodec/h264.c:1617:13: 1615. 1616. if (from[i]) 1617. memcpy(to[i], from[i], size); ^ 1618. } 1619. }
https://github.com/libav/libav/blob/b89e8759e053792704741d08cbc41c9ac3c7ed63/libavcodec/h264.c/#L1617
d2a_code_trace_data_44967
int TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s) { TIFFDirectory *td = &tif->tif_dir; if (x >= td->td_imagewidth) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Col out of range, max %lu", (unsigned long) x, (unsigned long) (td->td_imagewidth - 1)); return (0); } if (y >= td->td_imagelength) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Row out of range, max %lu", (unsigned long) y, (unsigned long) (td->td_imagelength - 1)); return (0); } if (z >= td->td_imagedepth) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Depth out of range, max %lu", (unsigned long) z, (unsigned long) (td->td_imagedepth - 1)); return (0); } if (td->td_planarconfig == PLANARCONFIG_SEPARATE && s >= td->td_samplesperpixel) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Sample out of range, max %lu", (unsigned long) s, (unsigned long) (td->td_samplesperpixel - 1)); return (0); } return (1); } libtiff/tif_getimage.c:742: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `TIFFReadTile`. libtiff/tif_getimage.c:722:8: Call 720. for (col = 0; col < w; col += tw) 721. { 722. if (TIFFReadTile(tif, p0, col+img->col_offset, ^ 723. row+img->row_offset,0,0)!=(tmsize_t)(-1) && img->stoponerr) 724. { libtiff/tif_read.c:415:1: Parameter `tif->tif_dir.td_imagewidth` 413. * tile is selected by the (x,y,z,s) coordinates. 414. */ 415. tmsize_t ^ 416. TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s) 417. { libtiff/tif_getimage.c:728:8: Call 726. break; 727. } 728. if (TIFFReadTile(tif, p1, col+img->col_offset, ^ 729. row+img->row_offset,0,1)!=(tmsize_t)(-1) && img->stoponerr) 730. { libtiff/tif_read.c:415:1: Parameter `tif->tif_dir.td_imagewidth` 413. * tile is selected by the (x,y,z,s) coordinates. 414. */ 415. tmsize_t ^ 416. TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s) 417. { libtiff/tif_getimage.c:734:8: Call 732. break; 733. } 734. if (TIFFReadTile(tif, p2, col+img->col_offset, ^ 735. row+img->row_offset,0,2)!=(tmsize_t)(-1) && img->stoponerr) 736. { libtiff/tif_read.c:415:1: Parameter `tif->tif_dir.td_imagewidth` 413. * tile is selected by the (x,y,z,s) coordinates. 414. */ 415. tmsize_t ^ 416. TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s) 417. { libtiff/tif_getimage.c:722:8: Call 720. for (col = 0; col < w; col += tw) 721. { 722. if (TIFFReadTile(tif, p0, col+img->col_offset, ^ 723. row+img->row_offset,0,0)!=(tmsize_t)(-1) && img->stoponerr) 724. { libtiff/tif_read.c:415:1: Parameter `tif->tif_dir.td_imagewidth` 413. * tile is selected by the (x,y,z,s) coordinates. 414. */ 415. tmsize_t ^ 416. TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s) 417. { libtiff/tif_getimage.c:728:8: Call 726. break; 727. } 728. if (TIFFReadTile(tif, p1, col+img->col_offset, ^ 729. row+img->row_offset,0,1)!=(tmsize_t)(-1) && img->stoponerr) 730. { libtiff/tif_read.c:415:1: Parameter `tif->tif_dir.td_imagewidth` 413. * tile is selected by the (x,y,z,s) coordinates. 414. */ 415. tmsize_t ^ 416. TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s) 417. { libtiff/tif_getimage.c:734:8: Call 732. break; 733. } 734. if (TIFFReadTile(tif, p2, col+img->col_offset, ^ 735. row+img->row_offset,0,2)!=(tmsize_t)(-1) && img->stoponerr) 736. { libtiff/tif_read.c:415:1: Parameter `tif->tif_dir.td_imagewidth` 413. * tile is selected by the (x,y,z,s) coordinates. 414. */ 415. tmsize_t ^ 416. TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s) 417. { libtiff/tif_getimage.c:742:9: Call 740. if (alpha) 741. { 742. if (TIFFReadTile(tif,pa,col+img->col_offset, ^ 743. row+img->row_offset,0,3)!=(tmsize_t)(-1) && img->stoponerr) 744. { libtiff/tif_read.c:415:1: Parameter `tif->tif_dir.td_imagewidth` 413. * tile is selected by the (x,y,z,s) coordinates. 414. */ 415. tmsize_t ^ 416. TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s) 417. { libtiff/tif_read.c:418:33: Call 416. TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s) 417. { 418. if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s)) ^ 419. return ((tmsize_t)(-1)); 420. return (TIFFReadEncodedTile(tif, libtiff/tif_tile.c:100:1: <LHS trace> 98. * against the image bounds. 99. */ 100. int ^ 101. TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s) 102. { libtiff/tif_tile.c:100:1: Parameter `x` 98. * against the image bounds. 99. */ 100. int ^ 101. TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s) 102. { libtiff/tif_tile.c:106:3: Binary operation: ([0, +oo] - 1):unsigned32 by call to `TIFFReadTile` 104. 105. if (x >= td->td_imagewidth) { 106. TIFFErrorExt(tif->tif_clientdata, tif->tif_name, ^ 107. "%lu: Col out of range, max %lu", 108. (unsigned long) x,
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_tile.c/#L106
d2a_code_trace_data_44968
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_x931p.c:238: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end`. Showing all 9 steps of the trace crypto/bn/bn_x931p.c:213:1: Parameter `ctx->stack.depth` 211. */ 212. 213. > int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, 214. BIGNUM *Xp1, BIGNUM *Xp2, 215. const BIGNUM *Xp, crypto/bn/bn_x931p.c:220:5: Call 218. int ret = 0; 219. 220. BN_CTX_start(ctx); ^ 221. if (Xp1 == NULL) 222. Xp1 = 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/bn/bn_x931p.c:238:5: Call 236. 237. error: 238. BN_CTX_end(ctx); ^ 239. 240. 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/a055a8815587f402d700093dea0dec6bf34631a3/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_44969
static char *shacrypt(const char *passwd, const char *magic, const char *salt) { static const char rounds_prefix[] = "rounds="; # define SALT_LEN_MAX 16 # define ROUNDS_DEFAULT 5000 # define ROUNDS_MIN 1000 # define ROUNDS_MAX 999999999 static char out_buf[3 + 17 + 17 + 86 + 1]; unsigned char buf[SHA512_DIGEST_LENGTH]; unsigned char temp_buf[SHA512_DIGEST_LENGTH]; size_t buf_size = 0; char ascii_magic[2]; char ascii_salt[17]; char *ascii_passwd = NULL; size_t n; EVP_MD_CTX *md = NULL, *md2 = NULL; const EVP_MD *sha = NULL; size_t passwd_len, salt_len, magic_len; unsigned int rounds = 5000; char rounds_custom = 0; char *p_bytes = NULL; char *s_bytes = NULL; char *cp = NULL; passwd_len = strlen(passwd); magic_len = strlen(magic); if (magic_len != 1) return NULL; switch (magic[0]) { case '5': sha = EVP_sha256(); buf_size = 32; break; case '6': sha = EVP_sha512(); buf_size = 64; break; default: return NULL; } if (strncmp(salt, rounds_prefix, sizeof(rounds_prefix) - 1) == 0) { const char *num = salt + sizeof(rounds_prefix) - 1; char *endp; unsigned long int srounds = strtoul (num, &endp, 10); if (*endp == '$') { salt = endp + 1; if (srounds > ROUNDS_MAX) rounds = ROUNDS_MAX; else if (srounds < ROUNDS_MIN) rounds = ROUNDS_MIN; else rounds = (unsigned int)srounds; rounds_custom = 1; } else { return NULL; } } OPENSSL_strlcpy(ascii_magic, magic, sizeof(ascii_magic)); #ifdef CHARSET_EBCDIC if ((magic[0] & 0x80) != 0) ebcdic2ascii(ascii_magic, ascii_magic, magic_len); #endif OPENSSL_strlcpy(ascii_salt, salt, sizeof(ascii_salt)); salt_len = strlen(ascii_salt); #ifdef CHARSET_EBCDIC ebcdic2ascii(ascii_salt, ascii_salt, salt_len); #endif #ifdef CHARSET_EBCDIC ascii_passwd = OPENSSL_strdup(passwd); if (ascii_passwd == NULL) return NULL; ebcdic2ascii(ascii_passwd, ascii_passwd, passwd_len); passwd = ascii_passwd; #endif out_buf[0] = 0; OPENSSL_strlcat(out_buf, ascii_dollar, sizeof(out_buf)); OPENSSL_strlcat(out_buf, ascii_magic, sizeof(out_buf)); OPENSSL_strlcat(out_buf, ascii_dollar, sizeof(out_buf)); if (rounds_custom) { char tmp_buf[80]; sprintf(tmp_buf, "rounds=%u", rounds); #ifdef CHARSET_EBCDIC if (tmp_buf[0] != 0x72) ebcdic2ascii(tmp_buf, tmp_buf, strlen(tmp_buf)); #endif OPENSSL_strlcat(out_buf, tmp_buf, sizeof(out_buf)); OPENSSL_strlcat(out_buf, ascii_dollar, sizeof(out_buf)); } OPENSSL_strlcat(out_buf, ascii_salt, sizeof(out_buf)); if (strlen(out_buf) > 3 + 17 * rounds_custom + salt_len ) goto err; md = EVP_MD_CTX_new(); if (md == NULL || !EVP_DigestInit_ex(md, sha, NULL) || !EVP_DigestUpdate(md, passwd, passwd_len) || !EVP_DigestUpdate(md, ascii_salt, salt_len)) goto err; md2 = EVP_MD_CTX_new(); if (md2 == NULL || !EVP_DigestInit_ex(md2, sha, NULL) || !EVP_DigestUpdate(md2, passwd, passwd_len) || !EVP_DigestUpdate(md2, ascii_salt, salt_len) || !EVP_DigestUpdate(md2, passwd, passwd_len) || !EVP_DigestFinal_ex(md2, buf, NULL)) goto err; for (n = passwd_len; n > buf_size; n -= buf_size) { if (!EVP_DigestUpdate(md, buf, buf_size)) goto err; } if (!EVP_DigestUpdate(md, buf, n)) goto err; n = passwd_len; while (n) { if (!EVP_DigestUpdate(md, (n & 1) ? buf : (unsigned const char *)passwd, (n & 1) ? buf_size : passwd_len)) goto err; n >>= 1; } if (!EVP_DigestFinal_ex(md, buf, NULL)) return NULL; if (!EVP_DigestInit_ex(md2, sha, NULL)) goto err; for (n = passwd_len; n > 0; n--) if (!EVP_DigestUpdate(md2, passwd, passwd_len)) goto err; if (!EVP_DigestFinal_ex(md2, temp_buf, NULL)) return NULL; if ((p_bytes = OPENSSL_zalloc(passwd_len)) == NULL) goto err; for (cp = p_bytes, n = passwd_len; n > buf_size; n -= buf_size, cp += buf_size) memcpy(cp, temp_buf, buf_size); memcpy(cp, temp_buf, n); if (!EVP_DigestInit_ex(md2, sha, NULL)) goto err; for (n = 16 + buf[0]; n > 0; n--) if (!EVP_DigestUpdate(md2, ascii_salt, salt_len)) goto err; if (!EVP_DigestFinal_ex(md2, temp_buf, NULL)) return NULL; if ((s_bytes = OPENSSL_zalloc(salt_len)) == NULL) goto err; for (cp = s_bytes, n = salt_len; n > buf_size; n -= buf_size, cp += buf_size) memcpy(cp, temp_buf, buf_size); memcpy(cp, temp_buf, n); for (n = 0; n < rounds; n++) { if (!EVP_DigestInit_ex(md2, sha, NULL)) goto err; if (!EVP_DigestUpdate(md2, (n & 1) ? (unsigned const char *)p_bytes : buf, (n & 1) ? passwd_len : buf_size)) goto err; if (n % 3) { if (!EVP_DigestUpdate(md2, s_bytes, salt_len)) goto err; } if (n % 7) { if (!EVP_DigestUpdate(md2, p_bytes, passwd_len)) goto err; } if (!EVP_DigestUpdate(md2, (n & 1) ? buf : (unsigned const char *)p_bytes, (n & 1) ? buf_size : passwd_len)) goto err; if (!EVP_DigestFinal_ex(md2, buf, NULL)) goto err; } EVP_MD_CTX_free(md2); EVP_MD_CTX_free(md); md2 = NULL; md = NULL; OPENSSL_free(p_bytes); OPENSSL_free(s_bytes); p_bytes = NULL; s_bytes = NULL; cp = out_buf + strlen(out_buf); *cp++ = ascii_dollar[0]; # define b64_from_24bit(B2, B1, B0, N) \ do { \ unsigned int w = ((B2) << 16) | ((B1) << 8) | (B0); \ int i = (N); \ while (i-- > 0) \ { \ *cp++ = cov_2char[w & 0x3f]; \ w >>= 6; \ } \ } while (0) switch (magic[0]) { case '5': b64_from_24bit (buf[0], buf[10], buf[20], 4); b64_from_24bit (buf[21], buf[1], buf[11], 4); b64_from_24bit (buf[12], buf[22], buf[2], 4); b64_from_24bit (buf[3], buf[13], buf[23], 4); b64_from_24bit (buf[24], buf[4], buf[14], 4); b64_from_24bit (buf[15], buf[25], buf[5], 4); b64_from_24bit (buf[6], buf[16], buf[26], 4); b64_from_24bit (buf[27], buf[7], buf[17], 4); b64_from_24bit (buf[18], buf[28], buf[8], 4); b64_from_24bit (buf[9], buf[19], buf[29], 4); b64_from_24bit (0, buf[31], buf[30], 3); break; case '6': b64_from_24bit (buf[0], buf[21], buf[42], 4); b64_from_24bit (buf[22], buf[43], buf[1], 4); b64_from_24bit (buf[44], buf[2], buf[23], 4); b64_from_24bit (buf[3], buf[24], buf[45], 4); b64_from_24bit (buf[25], buf[46], buf[4], 4); b64_from_24bit (buf[47], buf[5], buf[26], 4); b64_from_24bit (buf[6], buf[27], buf[48], 4); b64_from_24bit (buf[28], buf[49], buf[7], 4); b64_from_24bit (buf[50], buf[8], buf[29], 4); b64_from_24bit (buf[9], buf[30], buf[51], 4); b64_from_24bit (buf[31], buf[52], buf[10], 4); b64_from_24bit (buf[53], buf[11], buf[32], 4); b64_from_24bit (buf[12], buf[33], buf[54], 4); b64_from_24bit (buf[34], buf[55], buf[13], 4); b64_from_24bit (buf[56], buf[14], buf[35], 4); b64_from_24bit (buf[15], buf[36], buf[57], 4); b64_from_24bit (buf[37], buf[58], buf[16], 4); b64_from_24bit (buf[59], buf[17], buf[38], 4); b64_from_24bit (buf[18], buf[39], buf[60], 4); b64_from_24bit (buf[40], buf[61], buf[19], 4); b64_from_24bit (buf[62], buf[20], buf[41], 4); b64_from_24bit (0, 0, buf[63], 2); break; default: goto err; } *cp = '\0'; #ifdef CHARSET_EBCDIC ascii2ebcdic(out_buf, out_buf, strlen(out_buf)); #endif return out_buf; err: EVP_MD_CTX_free(md2); EVP_MD_CTX_free(md); OPENSSL_free(p_bytes); OPENSSL_free(s_bytes); OPENSSL_free(ascii_passwd); return NULL; } apps/passwd.c:840: error: BUFFER_OVERRUN_L3 Offset added: [-31, 64] Size: 64 by call to `shacrypt`. Showing all 7 steps of the trace apps/passwd.c:774:1: Parameter `pw_maxlen` 772. } 773. 774. > static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p, 775. char *passwd, BIO *out, int quiet, int table, 776. int reverse, size_t pw_maxlen, passwd_modes mode) apps/passwd.c:840:16: Call 838. hash = md5crypt(passwd, "", *salt_p); 839. if (mode == passwd_sha256 || mode == passwd_sha512) 840. hash = shacrypt(passwd, (mode == passwd_sha256 ? "5" : "6"), *salt_p); ^ 841. assert(hash != NULL); 842. apps/passwd.c:534:9: <Offset trace> 532. case '5': 533. sha = EVP_sha256(); 534. buf_size = 32; ^ 535. break; 536. case '6': apps/passwd.c:534:9: Assignment 532. case '5': 533. sha = EVP_sha256(); 534. buf_size = 32; ^ 535. break; 536. case '6': apps/passwd.c:493:1: <Length trace> 491. * (note that it's in the public domain) 492. */ 493. > static char *shacrypt(const char *passwd, const char *magic, const char *salt) 494. { 495. /* Prefix for optional rounds specification. */ apps/passwd.c:493:1: Array declaration 491. * (note that it's in the public domain) 492. */ 493. > static char *shacrypt(const char *passwd, const char *magic, const char *salt) 494. { 495. /* Prefix for optional rounds specification. */ apps/passwd.c:653:5: Array access: Offset added: [-31, 64] Size: 64 by call to `shacrypt` 651. for (cp = p_bytes, n = passwd_len; n > buf_size; n -= buf_size, cp += buf_size) 652. memcpy(cp, temp_buf, buf_size); 653. memcpy(cp, temp_buf, n); ^ 654. 655. /* S sequence */
https://github.com/openssl/openssl/blob/8ae173bb57819a23717fd3c8e7c51cb62f4268d0/apps/passwd.c/#L653
d2a_code_trace_data_44970
int ssl3_get_cert_verify(SSL *s) { EVP_PKEY *pkey=NULL; unsigned char *p; int al,ok,ret=0; long n; int type=0,i,j; X509 *peer; const EVP_MD *md = NULL; EVP_MD_CTX mctx; EVP_MD_CTX_init(&mctx); n=s->method->ssl_get_message(s, SSL3_ST_SR_CERT_VRFY_A, SSL3_ST_SR_CERT_VRFY_B, -1, SSL3_RT_MAX_PLAIN_LENGTH, &ok); if (!ok) return((int)n); if (s->session->peer != NULL) { peer=s->session->peer; pkey=X509_get_pubkey(peer); type=X509_certificate_type(peer,pkey); } else { peer=NULL; pkey=NULL; } if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_VERIFY) { s->s3->tmp.reuse_message=1; if ((peer != NULL) && (type & EVP_PKT_SIGN)) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_MISSING_VERIFY_MESSAGE); goto f_err; } ret=1; goto end; } if (peer == NULL) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_NO_CLIENT_CERT_RECEIVED); al=SSL_AD_UNEXPECTED_MESSAGE; goto f_err; } if (!(type & EVP_PKT_SIGN)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); al=SSL_AD_ILLEGAL_PARAMETER; goto f_err; } if (s->s3->change_cipher_spec) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY); al=SSL_AD_UNEXPECTED_MESSAGE; goto f_err; } p=(unsigned char *)s->init_msg; if (n==64 && (pkey->type==NID_id_GostR3410_94 || pkey->type == NID_id_GostR3410_2001) ) { i=64; } else { if (SSL_USE_SIGALGS(s)) { int rv = tls12_check_peer_sigalg(&md, s, p, pkey); if (rv == -1) { al = SSL_AD_INTERNAL_ERROR; goto f_err; } else if (rv == 0) { al = SSL_AD_DECODE_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, "USING TLSv1.2 HASH %s\n", EVP_MD_name(md)); #endif p += 2; n -= 2; } n2s(p,i); n-=2; if (i > n) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_LENGTH_MISMATCH); al=SSL_AD_DECODE_ERROR; goto f_err; } } j=EVP_PKEY_size(pkey); if ((i > j) || (n > j) || (n <= 0)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_WRONG_SIGNATURE_SIZE); al=SSL_AD_DECODE_ERROR; goto f_err; } if (SSL_USE_SIGALGS(s)) { long hdatalen = 0; void *hdata; hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); if (hdatalen <= 0) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR); al=SSL_AD_INTERNAL_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, "Using TLS 1.2 with client verify alg %s\n", EVP_MD_name(md)); #endif if (!EVP_VerifyInit_ex(&mctx, md, NULL) || !EVP_VerifyUpdate(&mctx, hdata, hdatalen)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_EVP_LIB); al=SSL_AD_INTERNAL_ERROR; goto f_err; } if (EVP_VerifyFinal(&mctx, p , i, pkey) <= 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_SIGNATURE); goto f_err; } } else #ifndef OPENSSL_NO_RSA if (pkey->type == EVP_PKEY_RSA) { i=RSA_verify(NID_md5_sha1, s->s3->tmp.cert_verify_md, MD5_DIGEST_LENGTH+SHA_DIGEST_LENGTH, p, i, pkey->pkey.rsa); if (i < 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_RSA_DECRYPT); goto f_err; } if (i == 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_RSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_DSA if (pkey->type == EVP_PKEY_DSA) { j=DSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH,p,i,pkey->pkey.dsa); if (j <= 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_DSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_ECDSA if (pkey->type == EVP_PKEY_EC) { j=ECDSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH,p,i,pkey->pkey.ec); if (j <= 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else #endif if (pkey->type == NID_id_GostR3410_94 || pkey->type == NID_id_GostR3410_2001) { unsigned char signature[64]; int idx; EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new(pkey,NULL); EVP_PKEY_verify_init(pctx); if (i!=64) { fprintf(stderr,"GOST signature length is %d",i); } for (idx=0;idx<64;idx++) { signature[63-idx]=p[idx]; } j=EVP_PKEY_verify(pctx,signature,64,s->s3->tmp.cert_verify_md,32); EVP_PKEY_CTX_free(pctx); if (j<=0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,ERR_R_INTERNAL_ERROR); al=SSL_AD_UNSUPPORTED_CERTIFICATE; goto f_err; } ret=1; if (0) { f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); } end: if (s->s3->handshake_buffer) { BIO_free(s->s3->handshake_buffer); s->s3->handshake_buffer = NULL; s->s3->flags &= ~TLS1_FLAGS_KEEP_HANDSHAKE; } EVP_MD_CTX_cleanup(&mctx); EVP_PKEY_free(pkey); return(ret); } ssl/s3_srvr.c:3094: error: NULL_DEREFERENCE pointer `pkey` last assigned on line 3046 could be null and is dereferenced at line 3094, column 16. Showing all 27 steps of the trace ssl/s3_srvr.c:3022:1: start of procedure ssl3_get_cert_verify() 3020. } 3021. 3022. > int ssl3_get_cert_verify(SSL *s) 3023. { 3024. EVP_PKEY *pkey=NULL; ssl/s3_srvr.c:3024:2: 3022. int ssl3_get_cert_verify(SSL *s) 3023. { 3024. > EVP_PKEY *pkey=NULL; 3025. unsigned char *p; 3026. int al,ok,ret=0; ssl/s3_srvr.c:3026:2: 3024. EVP_PKEY *pkey=NULL; 3025. unsigned char *p; 3026. > int al,ok,ret=0; 3027. long n; 3028. int type=0,i,j; ssl/s3_srvr.c:3028:2: 3026. int al,ok,ret=0; 3027. long n; 3028. > int type=0,i,j; 3029. X509 *peer; 3030. const EVP_MD *md = NULL; ssl/s3_srvr.c:3030:2: 3028. int type=0,i,j; 3029. X509 *peer; 3030. > const EVP_MD *md = NULL; 3031. EVP_MD_CTX mctx; 3032. EVP_MD_CTX_init(&mctx); ssl/s3_srvr.c:3032:2: 3030. const EVP_MD *md = NULL; 3031. EVP_MD_CTX mctx; 3032. > EVP_MD_CTX_init(&mctx); 3033. 3034. n=s->method->ssl_get_message(s, crypto/evp/digest.c:120:1: start of procedure EVP_MD_CTX_init() 118. #endif 119. 120. > void EVP_MD_CTX_init(EVP_MD_CTX *ctx) 121. { 122. memset(ctx,'\0',sizeof *ctx); crypto/evp/digest.c:122:2: 120. void EVP_MD_CTX_init(EVP_MD_CTX *ctx) 121. { 122. > memset(ctx,'\0',sizeof *ctx); 123. } 124. crypto/evp/digest.c:123:2: return from a call to EVP_MD_CTX_init 121. { 122. memset(ctx,'\0',sizeof *ctx); 123. } ^ 124. 125. EVP_MD_CTX *EVP_MD_CTX_create(void) ssl/s3_srvr.c:3034:2: Skipping __function_pointer__(): unresolved function pointer 3032. EVP_MD_CTX_init(&mctx); 3033. 3034. n=s->method->ssl_get_message(s, ^ 3035. SSL3_ST_SR_CERT_VRFY_A, 3036. SSL3_ST_SR_CERT_VRFY_B, ssl/s3_srvr.c:3041:7: Taking false branch 3039. &ok); 3040. 3041. if (!ok) return((int)n); ^ 3042. 3043. if (s->session->peer != NULL) ssl/s3_srvr.c:3043:6: Taking true branch 3041. if (!ok) return((int)n); 3042. 3043. if (s->session->peer != NULL) ^ 3044. { 3045. peer=s->session->peer; ssl/s3_srvr.c:3045:3: 3043. if (s->session->peer != NULL) 3044. { 3045. > peer=s->session->peer; 3046. pkey=X509_get_pubkey(peer); 3047. type=X509_certificate_type(peer,pkey); ssl/s3_srvr.c:3046:3: 3044. { 3045. peer=s->session->peer; 3046. > pkey=X509_get_pubkey(peer); 3047. type=X509_certificate_type(peer,pkey); 3048. } crypto/x509/x509_cmp.c:313:1: start of procedure X509_get_pubkey() 311. } 312. 313. > EVP_PKEY *X509_get_pubkey(X509 *x) 314. { 315. if ((x == NULL) || (x->cert_info == NULL)) crypto/x509/x509_cmp.c:315:7: Taking false branch 313. EVP_PKEY *X509_get_pubkey(X509 *x) 314. { 315. if ((x == NULL) || (x->cert_info == NULL)) ^ 316. return(NULL); 317. return(X509_PUBKEY_get(x->cert_info->key)); crypto/x509/x509_cmp.c:315:22: Taking true branch 313. EVP_PKEY *X509_get_pubkey(X509 *x) 314. { 315. if ((x == NULL) || (x->cert_info == NULL)) ^ 316. return(NULL); 317. return(X509_PUBKEY_get(x->cert_info->key)); crypto/x509/x509_cmp.c:316:3: 314. { 315. if ((x == NULL) || (x->cert_info == NULL)) 316. > return(NULL); 317. return(X509_PUBKEY_get(x->cert_info->key)); 318. } crypto/x509/x509_cmp.c:318:2: return from a call to X509_get_pubkey 316. return(NULL); 317. return(X509_PUBKEY_get(x->cert_info->key)); 318. } ^ 319. 320. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x) ssl/s3_srvr.c:3047:3: Skipping X509_certificate_type(): empty list of specs 3045. peer=s->session->peer; 3046. pkey=X509_get_pubkey(peer); 3047. type=X509_certificate_type(peer,pkey); ^ 3048. } 3049. else ssl/s3_srvr.c:3055:6: Taking false branch 3053. } 3054. 3055. if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_VERIFY) ^ 3056. { 3057. s->s3->tmp.reuse_message=1; ssl/s3_srvr.c:3068:6: Taking false branch 3066. } 3067. 3068. if (peer == NULL) ^ 3069. { 3070. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_NO_CLIENT_CERT_RECEIVED); ssl/s3_srvr.c:3075:8: Taking false branch 3073. } 3074. 3075. if (!(type & EVP_PKT_SIGN)) ^ 3076. { 3077. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); ssl/s3_srvr.c:3082:6: Taking false branch 3080. } 3081. 3082. if (s->s3->change_cipher_spec) ^ 3083. { 3084. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY); ssl/s3_srvr.c:3090:2: 3088. 3089. /* we now have a signature that we need to verify */ 3090. > p=(unsigned char *)s->init_msg; 3091. /* Check for broken implementations of GOST ciphersuites */ 3092. /* If key is GOST and n is exactly 64, it is bare ssl/s3_srvr.c:3094:6: Taking true branch 3092. /* If key is GOST and n is exactly 64, it is bare 3093. * signature without length field */ 3094. if (n==64 && (pkey->type==NID_id_GostR3410_94 || ^ 3095. pkey->type == NID_id_GostR3410_2001) ) 3096. { ssl/s3_srvr.c:3094:16: 3092. /* If key is GOST and n is exactly 64, it is bare 3093. * signature without length field */ 3094. > if (n==64 && (pkey->type==NID_id_GostR3410_94 || 3095. pkey->type == NID_id_GostR3410_2001) ) 3096. {
https://github.com/openssl/openssl/blob/3881d8106df732fc433d30446625dfa2396da42d/ssl/s3_srvr.c/#L3094
d2a_code_trace_data_44971
static int compat_decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *pkt) { AVCodecInternal *avci = avctx->internal; int ret; av_assert0(avci->compat_decode_consumed == 0); *got_frame = 0; avci->compat_decode = 1; if (avci->compat_decode_partial_size > 0 && avci->compat_decode_partial_size != pkt->size) { av_log(avctx, AV_LOG_ERROR, "Got unexpected packet size after a partial decode\n"); ret = AVERROR(EINVAL); goto finish; } if (!avci->compat_decode_partial_size) { ret = avcodec_send_packet(avctx, pkt); if (ret == AVERROR_EOF) ret = 0; else if (ret == AVERROR(EAGAIN)) { ret = AVERROR_BUG; goto finish; } else if (ret < 0) goto finish; } while (ret >= 0) { ret = avcodec_receive_frame(avctx, frame); if (ret < 0) { if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) ret = 0; goto finish; } if (frame != avci->compat_decode_frame) { if (!avctx->refcounted_frames) { ret = unrefcount_frame(avci, frame); if (ret < 0) goto finish; } *got_frame = 1; frame = avci->compat_decode_frame; } else { if (!avci->compat_decode_warned) { av_log(avctx, AV_LOG_WARNING, "The deprecated avcodec_decode_* " "API cannot return all the frames for this decoder. " "Some frames will be dropped. Update your code to the " "new decoding API to fix this.\n"); avci->compat_decode_warned = 1; } } if (avci->draining || (!avctx->codec->bsfs && avci->compat_decode_consumed < pkt->size)) break; } finish: if (ret == 0) { if (avctx->codec->bsfs) ret = pkt->size; else ret = FFMIN(avci->compat_decode_consumed, pkt->size); } avci->compat_decode_consumed = 0; avci->compat_decode_partial_size = (ret >= 0) ? pkt->size - ret : 0; return ret; } libavcodec/decode.c:663: error: Uninitialized Value The value read from ret was never initialized. libavcodec/decode.c:663:5: 661. avci->compat_decode_partial_size = (ret >= 0) ? pkt->size - ret : 0; 662. 663. return ret; ^ 664. } 665.
https://github.com/libav/libav/blob/839010aca9713b5cd6ebe7a1db7e805c3625b168/libavcodec/decode.c/#L663
d2a_code_trace_data_44972
DEFINE_RUN_ONCE_STATIC(do_load_builtin_compressions) { SSL_COMP *comp = NULL; COMP_METHOD *method = COMP_zlib(); CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp); if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) { comp = OPENSSL_malloc(sizeof(*comp)); if (comp != NULL) { comp->method = method; comp->id = SSL_COMP_ZLIB_IDX; comp->name = COMP_get_name(method); sk_SSL_COMP_push(ssl_comp_methods, comp); sk_SSL_COMP_sort(ssl_comp_methods); } } CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE); return 1; } ssl/ssl_ciph.c:458: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_malloc()` at line 453, column 16 is not reachable after line 458, column 13. Showing all 44 steps of the trace ssl/ssl_ciph.c:444:1: start of procedure do_load_builtin_compressions() 442. } 443. 444. > DEFINE_RUN_ONCE_STATIC(do_load_builtin_compressions) 445. { 446. SSL_COMP *comp = NULL; ssl/ssl_ciph.c:446:5: 444. DEFINE_RUN_ONCE_STATIC(do_load_builtin_compressions) 445. { 446. > SSL_COMP *comp = NULL; 447. COMP_METHOD *method = COMP_zlib(); 448. ssl/ssl_ciph.c:447:5: 445. { 446. SSL_COMP *comp = NULL; 447. > COMP_METHOD *method = COMP_zlib(); 448. 449. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); crypto/comp/c_zlib.c:209:1: start of procedure COMP_zlib() 207. #endif 208. 209. > COMP_METHOD *COMP_zlib(void) 210. { 211. COMP_METHOD *meth = &zlib_method_nozlib; crypto/comp/c_zlib.c:211:5: 209. COMP_METHOD *COMP_zlib(void) 210. { 211. > COMP_METHOD *meth = &zlib_method_nozlib; 212. 213. #ifdef ZLIB_SHARED crypto/comp/c_zlib.c:259:5: 257. #endif 258. 259. > return (meth); 260. } 261. crypto/comp/c_zlib.c:260:1: return from a call to COMP_zlib 258. 259. return (meth); 260. > } 261. 262. void comp_zlib_cleanup_int(void) ssl/ssl_ciph.c:449:5: 447. COMP_METHOD *method = COMP_zlib(); 448. 449. > CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 450. ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp); 451. crypto/mem_dbg.c:117:1: start of procedure CRYPTO_mem_ctrl() 115. #endif 116. 117. > int CRYPTO_mem_ctrl(int mode) 118. { 119. #ifdef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem_dbg.c:120:5: 118. { 119. #ifdef OPENSSL_NO_CRYPTO_MDEBUG 120. > return mode - mode; 121. #else 122. int ret = mh_mode; crypto/mem_dbg.c:188:1: return from a call to CRYPTO_mem_ctrl 186. return ret; 187. #endif 188. > } 189. 190. #ifndef OPENSSL_NO_CRYPTO_MDEBUG ssl/ssl_ciph.c:450:5: 448. 449. CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE); 450. > ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp); 451. 452. if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) { include/openssl/ssl.h:901:1: start of procedure sk_SSL_COMP_new() 899. */ 900. DEFINE_STACK_OF_CONST(SSL_CIPHER) 901. > DEFINE_STACK_OF(SSL_COMP) 902. 903. /* compatibility */ include/openssl/ssl.h:901:1: return from a call to sk_SSL_COMP_new 899. */ 900. DEFINE_STACK_OF_CONST(SSL_CIPHER) 901. > DEFINE_STACK_OF(SSL_COMP) 902. 903. /* compatibility */ ssl/ssl_ciph.c:452:9: 450. ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp); 451. 452. > if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) { 453. comp = OPENSSL_malloc(sizeof(*comp)); 454. if (comp != NULL) { crypto/comp/comp_lib.c:36:1: start of procedure COMP_get_type() 34. } 35. 36. > int COMP_get_type(const COMP_METHOD *meth) 37. { 38. return meth->type; crypto/comp/comp_lib.c:38:5: 36. int COMP_get_type(const COMP_METHOD *meth) 37. { 38. > return meth->type; 39. } 40. crypto/comp/comp_lib.c:39:1: return from a call to COMP_get_type 37. { 38. return meth->type; 39. > } 40. 41. const char *COMP_get_name(const COMP_METHOD *meth) ssl/ssl_ciph.c:452:9: Taking true branch 450. ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp); 451. 452. if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) { ^ 453. comp = OPENSSL_malloc(sizeof(*comp)); 454. if (comp != NULL) { ssl/ssl_ciph.c:452:47: Taking true branch 450. ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp); 451. 452. if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) { ^ 453. comp = OPENSSL_malloc(sizeof(*comp)); 454. if (comp != NULL) { ssl/ssl_ciph.c:453:9: 451. 452. if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) { 453. > comp = OPENSSL_malloc(sizeof(*comp)); 454. if (comp != NULL) { 455. comp->method = method; crypto/mem.c:169:1: start of procedure CRYPTO_malloc() 167. #endif 168. 169. > void *CRYPTO_malloc(size_t num, const char *file, int line) 170. { 171. void *ret = NULL; crypto/mem.c:171:5: 169. void *CRYPTO_malloc(size_t num, const char *file, int line) 170. { 171. > void *ret = NULL; 172. 173. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:173:9: Taking false branch 171. void *ret = NULL; 172. 173. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 174. return malloc_impl(num, file, line); 175. crypto/mem.c:176:9: Taking false branch 174. return malloc_impl(num, file, line); 175. 176. if (num == 0) ^ 177. return NULL; 178. crypto/mem.c:180:5: 178. 179. FAILTEST(); 180. > allow_customize = 0; 181. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 182. if (call_malloc_debug) { crypto/mem.c:190:5: 188. } 189. #else 190. > osslargused(file); osslargused(line); 191. ret = malloc(num); 192. #endif crypto/mem.c:190:24: 188. } 189. #else 190. > osslargused(file); osslargused(line); 191. ret = malloc(num); 192. #endif crypto/mem.c:191:5: 189. #else 190. osslargused(file); osslargused(line); 191. > ret = malloc(num); 192. #endif 193. crypto/mem.c:194:5: 192. #endif 193. 194. > return ret; 195. } 196. crypto/mem.c:195:1: return from a call to CRYPTO_malloc 193. 194. return ret; 195. > } 196. 197. void *CRYPTO_zalloc(size_t num, const char *file, int line) ssl/ssl_ciph.c:454:13: Taking true branch 452. if (COMP_get_type(method) != NID_undef && ssl_comp_methods != NULL) { 453. comp = OPENSSL_malloc(sizeof(*comp)); 454. if (comp != NULL) { ^ 455. comp->method = method; 456. comp->id = SSL_COMP_ZLIB_IDX; ssl/ssl_ciph.c:455:13: 453. comp = OPENSSL_malloc(sizeof(*comp)); 454. if (comp != NULL) { 455. > comp->method = method; 456. comp->id = SSL_COMP_ZLIB_IDX; 457. comp->name = COMP_get_name(method); ssl/ssl_ciph.c:456:13: 454. if (comp != NULL) { 455. comp->method = method; 456. > comp->id = SSL_COMP_ZLIB_IDX; 457. comp->name = COMP_get_name(method); 458. sk_SSL_COMP_push(ssl_comp_methods, comp); ssl/ssl_ciph.c:457:13: 455. comp->method = method; 456. comp->id = SSL_COMP_ZLIB_IDX; 457. > comp->name = COMP_get_name(method); 458. sk_SSL_COMP_push(ssl_comp_methods, comp); 459. sk_SSL_COMP_sort(ssl_comp_methods); crypto/comp/comp_lib.c:41:1: start of procedure COMP_get_name() 39. } 40. 41. > const char *COMP_get_name(const COMP_METHOD *meth) 42. { 43. return meth->name; crypto/comp/comp_lib.c:43:5: 41. const char *COMP_get_name(const COMP_METHOD *meth) 42. { 43. > return meth->name; 44. } 45. crypto/comp/comp_lib.c:44:1: return from a call to COMP_get_name 42. { 43. return meth->name; 44. > } 45. 46. void COMP_CTX_free(COMP_CTX *ctx) ssl/ssl_ciph.c:458:13: 456. comp->id = SSL_COMP_ZLIB_IDX; 457. comp->name = COMP_get_name(method); 458. > sk_SSL_COMP_push(ssl_comp_methods, comp); 459. sk_SSL_COMP_sort(ssl_comp_methods); 460. } include/openssl/ssl.h:901:1: start of procedure sk_SSL_COMP_push() 899. */ 900. DEFINE_STACK_OF_CONST(SSL_CIPHER) 901. > DEFINE_STACK_OF(SSL_COMP) 902. 903. /* compatibility */ crypto/stack/stack.c:219:1: start of procedure OPENSSL_sk_push() 217. } 218. 219. > int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data) 220. { 221. return (OPENSSL_sk_insert(st, data, st->num)); crypto/stack/stack.c:221:5: Skipping OPENSSL_sk_insert(): empty list of specs 219. int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data) 220. { 221. return (OPENSSL_sk_insert(st, data, st->num)); ^ 222. } 223. crypto/stack/stack.c:222:1: return from a call to OPENSSL_sk_push 220. { 221. return (OPENSSL_sk_insert(st, data, st->num)); 222. > } 223. 224. int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data) include/openssl/ssl.h:901:1: return from a call to sk_SSL_COMP_push 899. */ 900. DEFINE_STACK_OF_CONST(SSL_CIPHER) 901. > DEFINE_STACK_OF(SSL_COMP) 902. 903. /* compatibility */
https://github.com/openssl/openssl/blob/bbb4ceb86eb6ea0300f744443c36fb6e980fff9d/ssl/ssl_ciph.c/#L458
d2a_code_trace_data_44973
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:495: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit`. libavcodec/wavpack.c:492:21: Call 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) 494. exp = bitstream_read(&s->bc_extra_bits, 8); libavcodec/bitstream.h:183:1: Parameter `bc->bits_left` 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/wavpack.c:495:24: Call 493. if (s->float_max_exp >= 25) 494. exp = bitstream_read(&s->bc_extra_bits, 8); 495. sign = bitstream_read_bit(&s->bc_extra_bits); ^ 496. } else { 497. if (s->float_flag & WV_FLT_ZERO_SIGN) 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 `bitstream_read_bit` 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_44974
void t2p_read_tiff_size(T2P* t2p, TIFF* input){ uint64* sbc=NULL; #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT) unsigned char* jpt=NULL; tstrip_t i=0; tstrip_t stripcount=0; #endif #ifdef OJPEG_SUPPORT tsize_t k = 0; #endif if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){ #ifdef CCITT_SUPPORT if(t2p->pdf_compression == T2P_COMPRESS_G4 ){ TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc); t2p->tiff_datasize=(tmsize_t)sbc[0]; return; } #endif #ifdef ZIP_SUPPORT if(t2p->pdf_compression == T2P_COMPRESS_ZIP){ TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc); t2p->tiff_datasize=(tmsize_t)sbc[0]; return; } #endif #ifdef OJPEG_SUPPORT if(t2p->tiff_compression == COMPRESSION_OJPEG){ if(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){ TIFFError(TIFF2PDF_MODULE, "Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS", TIFFFileName(input)); t2p->t2p_error = T2P_ERR_ERROR; return; } stripcount=TIFFNumberOfStrips(input); for(i=0;i<stripcount;i++){ k += sbc[i]; } if(TIFFGetField(input, TIFFTAG_JPEGIFOFFSET, &(t2p->tiff_dataoffset))){ if(t2p->tiff_dataoffset != 0){ if(TIFFGetField(input, TIFFTAG_JPEGIFBYTECOUNT, &(t2p->tiff_datasize))!=0){ if(t2p->tiff_datasize < k) { t2p->pdf_ojpegiflength=t2p->tiff_datasize; t2p->tiff_datasize+=k; t2p->tiff_datasize+=6; t2p->tiff_datasize+=2*stripcount; TIFFWarning(TIFF2PDF_MODULE, "Input file %s has short JPEG interchange file byte count", TIFFFileName(input)); return; } return; }else { TIFFError(TIFF2PDF_MODULE, "Input file %s missing field: TIFFTAG_JPEGIFBYTECOUNT", TIFFFileName(input)); t2p->t2p_error = T2P_ERR_ERROR; return; } } } t2p->tiff_datasize+=k; t2p->tiff_datasize+=2*stripcount; t2p->tiff_datasize+=2048; return; } #endif #ifdef JPEG_SUPPORT if(t2p->tiff_compression == COMPRESSION_JPEG) { uint32 count = 0; if(TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt) != 0 ){ if(count > 4){ t2p->tiff_datasize += count; t2p->tiff_datasize -= 2; } } else { t2p->tiff_datasize = 2; } stripcount=TIFFNumberOfStrips(input); if(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){ TIFFError(TIFF2PDF_MODULE, "Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS", TIFFFileName(input)); t2p->t2p_error = T2P_ERR_ERROR; return; } for(i=0;i<stripcount;i++){ t2p->tiff_datasize += sbc[i]; t2p->tiff_datasize -=4; } t2p->tiff_datasize +=2; return; } #endif (void) 0; } t2p->tiff_datasize=TIFFScanlineSize(input) * t2p->tiff_length; if(t2p->tiff_planar==PLANARCONFIG_SEPARATE){ t2p->tiff_datasize*= t2p->tiff_samplesperpixel; } return; } tools/tiff2pdf.c:1795: error: Null Dereference pointer `sbc` last assigned on line 1774 could be null and is dereferenced at line 1795, column 33. tools/tiff2pdf.c:1772:1: start of procedure t2p_read_tiff_size() 1770. */ 1771. 1772. void t2p_read_tiff_size(T2P* t2p, TIFF* input){ ^ 1773. 1774. uint64* sbc=NULL; tools/tiff2pdf.c:1774:2: 1772. void t2p_read_tiff_size(T2P* t2p, TIFF* input){ 1773. 1774. uint64* sbc=NULL; ^ 1775. #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT) 1776. unsigned char* jpt=NULL; tools/tiff2pdf.c:1776:2: 1774. uint64* sbc=NULL; 1775. #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT) 1776. unsigned char* jpt=NULL; ^ 1777. tstrip_t i=0; 1778. tstrip_t stripcount=0; tools/tiff2pdf.c:1777:2: 1775. #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT) 1776. unsigned char* jpt=NULL; 1777. tstrip_t i=0; ^ 1778. tstrip_t stripcount=0; 1779. #endif tools/tiff2pdf.c:1778:2: 1776. unsigned char* jpt=NULL; 1777. tstrip_t i=0; 1778. tstrip_t stripcount=0; ^ 1779. #endif 1780. #ifdef OJPEG_SUPPORT tools/tiff2pdf.c:1781:9: 1779. #endif 1780. #ifdef OJPEG_SUPPORT 1781. tsize_t k = 0; ^ 1782. #endif 1783. tools/tiff2pdf.c:1784:5: Taking true branch 1782. #endif 1783. 1784. if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){ ^ 1785. #ifdef CCITT_SUPPORT 1786. if(t2p->pdf_compression == T2P_COMPRESS_G4 ){ tools/tiff2pdf.c:1786:6: Taking false branch 1784. if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){ 1785. #ifdef CCITT_SUPPORT 1786. if(t2p->pdf_compression == T2P_COMPRESS_G4 ){ ^ 1787. TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc); 1788. t2p->tiff_datasize=(tmsize_t)sbc[0]; tools/tiff2pdf.c:1793:6: Taking true branch 1791. #endif 1792. #ifdef ZIP_SUPPORT 1793. if(t2p->pdf_compression == T2P_COMPRESS_ZIP){ ^ 1794. TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc); 1795. t2p->tiff_datasize=(tmsize_t)sbc[0]; tools/tiff2pdf.c:1794:4: 1792. #ifdef ZIP_SUPPORT 1793. if(t2p->pdf_compression == T2P_COMPRESS_ZIP){ 1794. TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc); ^ 1795. t2p->tiff_datasize=(tmsize_t)sbc[0]; 1796. return; libtiff/tif_dir.c:1100:1: start of procedure TIFFGetField() 1098. * internal directory structure. 1099. */ 1100. int ^ 1101. TIFFGetField(TIFF* tif, uint32 tag, ...) 1102. { libtiff/tif_dir.c:1106:2: 1104. va_list ap; 1105. 1106. va_start(ap, tag); ^ 1107. status = TIFFVGetField(tif, tag, ap); 1108. va_end(ap); libtiff/tif_dir.c:1107:2: Skipping TIFFVGetField(): empty list of specs 1105. 1106. va_start(ap, tag); 1107. status = TIFFVGetField(tif, tag, ap); ^ 1108. va_end(ap); 1109. return (status); libtiff/tif_dir.c:1108:2: 1106. va_start(ap, tag); 1107. status = TIFFVGetField(tif, tag, ap); 1108. va_end(ap); ^ 1109. return (status); 1110. } libtiff/tif_dir.c:1109:2: 1107. status = TIFFVGetField(tif, tag, ap); 1108. va_end(ap); 1109. return (status); ^ 1110. } 1111. libtiff/tif_dir.c:1110:1: return from a call to TIFFGetField 1108. va_end(ap); 1109. return (status); 1110. } ^ 1111. 1112. /* tools/tiff2pdf.c:1795:4: 1793. if(t2p->pdf_compression == T2P_COMPRESS_ZIP){ 1794. TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc); 1795. t2p->tiff_datasize=(tmsize_t)sbc[0]; ^ 1796. return; 1797. }
https://gitlab.com/libtiff/libtiff/blob/b69a1998bedfabc32cd541408bffdef05bd01e45/tools/tiff2pdf.c/#L1795
d2a_code_trace_data_44975
static int cca_rsa_sign(int type, const unsigned char *m, unsigned int m_len, unsigned char *sigret, unsigned int *siglen, const RSA *rsa) { long returnCode; long reasonCode; long exitDataLength = 0; unsigned char exitData[8]; long ruleArrayLength = 1; unsigned char ruleArray[8] = "PKCS-1.1"; long outputLength=256; long outputBitLength; long keyTokenLength; unsigned char *hashBuffer = NULL; unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx); long length = SSL_SIG_LEN; long keyLength ; X509_SIG sig; ASN1_TYPE parameter; X509_ALGOR algorithm; ASN1_OCTET_STRING digest; keyTokenLength = *(long*)keyToken; keyToken+=sizeof(long); if (type == NID_md5 || type == NID_sha1) { sig.algor = &algorithm; algorithm.algorithm = OBJ_nid2obj(type); if (!algorithm.algorithm) { CCA4758err(CCA4758_F_IBM_4758_CCA_SIGN, CCA4758_R_UNKNOWN_ALGORITHM_TYPE); return 0; } if (!algorithm.algorithm->length) { CCA4758err(CCA4758_F_IBM_4758_CCA_SIGN, CCA4758_R_ASN1_OID_UNKNOWN_FOR_MD); return 0; } parameter.type = V_ASN1_NULL; parameter.value.ptr = NULL; algorithm.parameter = &parameter; sig.digest = &digest; sig.digest->data = (unsigned char*)m; sig.digest->length = m_len; length = i2d_X509_SIG(&sig, NULL); } keyLength = RSA_size(rsa); if (length - RSA_PKCS1_PADDING > keyLength) { CCA4758err(CCA4758_F_IBM_4758_CCA_SIGN, CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL); return 0; } switch (type) { case NID_md5_sha1 : if (m_len != SSL_SIG_LEN) { CCA4758err(CCA4758_F_IBM_4758_CCA_SIGN, CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL); return 0; } hashBuffer = (unsigned char*)m; length = m_len; break; case NID_md5 : { unsigned char *ptr; ptr = hashBuffer = OPENSSL_malloc( (unsigned int)keyLength+1); if (!hashBuffer) { CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY, ERR_R_MALLOC_FAILURE); return 0; } i2d_X509_SIG(&sig, &ptr); } break; case NID_sha1 : { unsigned char *ptr; ptr = hashBuffer = OPENSSL_malloc( (unsigned int)keyLength+1); if (!hashBuffer) { CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY, ERR_R_MALLOC_FAILURE); return 0; } i2d_X509_SIG(&sig, &ptr); } break; default: return 0; } digitalSignatureGenerate(&returnCode, &reasonCode, &exitDataLength, exitData, &ruleArrayLength, ruleArray, &keyTokenLength, keyToken, &length, hashBuffer, &outputLength, &outputBitLength, sigret); if (type == NID_sha1 || type == NID_md5) { memset(hashBuffer, keyLength+1, 0); OPENSSL_free(hashBuffer); } *siglen = outputLength; return ((returnCode || reasonCode) ? 0 : 1); } crypto/engine/hw_4758_cca.c:731: error: NULL_DEREFERENCE pointer `keyToken` last assigned on line 723 could be null and is dereferenced at line 731, column 19. Showing all 22 steps of the trace crypto/engine/hw_4758_cca.c:710:1: start of procedure cca_rsa_sign() 708. #define SSL_SIG_LEN 36 709. 710. > static int cca_rsa_sign(int type, const unsigned char *m, unsigned int m_len, 711. unsigned char *sigret, unsigned int *siglen, const RSA *rsa) 712. { crypto/engine/hw_4758_cca.c:715:2: 713. long returnCode; 714. long reasonCode; 715. > long exitDataLength = 0; 716. unsigned char exitData[8]; 717. long ruleArrayLength = 1; crypto/engine/hw_4758_cca.c:717:2: 715. long exitDataLength = 0; 716. unsigned char exitData[8]; 717. > long ruleArrayLength = 1; 718. unsigned char ruleArray[8] = "PKCS-1.1"; 719. long outputLength=256; crypto/engine/hw_4758_cca.c:718:2: 716. unsigned char exitData[8]; 717. long ruleArrayLength = 1; 718. > unsigned char ruleArray[8] = "PKCS-1.1"; 719. long outputLength=256; 720. long outputBitLength; crypto/engine/hw_4758_cca.c:719:2: 717. long ruleArrayLength = 1; 718. unsigned char ruleArray[8] = "PKCS-1.1"; 719. > long outputLength=256; 720. long outputBitLength; 721. long keyTokenLength; crypto/engine/hw_4758_cca.c:722:2: 720. long outputBitLength; 721. long keyTokenLength; 722. > unsigned char *hashBuffer = NULL; 723. unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx); 724. long length = SSL_SIG_LEN; crypto/engine/hw_4758_cca.c:723:2: 721. long keyTokenLength; 722. unsigned char *hashBuffer = NULL; 723. > unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx); 724. long length = SSL_SIG_LEN; 725. long keyLength ; crypto/rsa/rsa_lib.c:243:1: start of procedure RSA_get_ex_data() 241. } 242. 243. > void *RSA_get_ex_data(const RSA *r, int idx) 244. { 245. return(CRYPTO_get_ex_data(&r->ex_data,idx)); crypto/rsa/rsa_lib.c:245:2: 243. void *RSA_get_ex_data(const RSA *r, int idx) 244. { 245. > return(CRYPTO_get_ex_data(&r->ex_data,idx)); 246. } 247. crypto/ex_data.c:626:1: start of procedure CRYPTO_get_ex_data() 624. /* For a given CRYPTO_EX_DATA_ variable, get the value corresponding to a 625. * particular index in the class used by this variable */ 626. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 627. { 628. if (ad->sk == NULL) crypto/ex_data.c:628:6: Taking false branch 626. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 627. { 628. if (ad->sk == NULL) ^ 629. return(0); 630. else if (idx >= sk_num(ad->sk)) crypto/ex_data.c:630:11: 628. if (ad->sk == NULL) 629. return(0); 630. > else if (idx >= sk_num(ad->sk)) 631. return(0); 632. else crypto/stack/stack.c:301:1: start of procedure sk_num() 299. } 300. 301. > int sk_num(const STACK *st) 302. { 303. if(st == NULL) return -1; crypto/stack/stack.c:303:5: Taking false branch 301. int sk_num(const STACK *st) 302. { 303. if(st == NULL) return -1; ^ 304. return st->num; 305. } crypto/stack/stack.c:304:2: 302. { 303. if(st == NULL) return -1; 304. > return st->num; 305. } 306. crypto/stack/stack.c:305:1: return from a call to sk_num 303. if(st == NULL) return -1; 304. return st->num; 305. > } 306. 307. char *sk_value(const STACK *st, int i) crypto/ex_data.c:630:11: Taking true branch 628. if (ad->sk == NULL) 629. return(0); 630. else if (idx >= sk_num(ad->sk)) ^ 631. return(0); 632. else crypto/ex_data.c:631:3: 629. return(0); 630. else if (idx >= sk_num(ad->sk)) 631. > return(0); 632. else 633. return(sk_value(ad->sk,idx)); crypto/ex_data.c:634:2: return from a call to CRYPTO_get_ex_data 632. else 633. return(sk_value(ad->sk,idx)); 634. } ^ 635. 636. IMPLEMENT_STACK_OF(CRYPTO_EX_DATA_FUNCS) crypto/rsa/rsa_lib.c:246:2: return from a call to RSA_get_ex_data 244. { 245. return(CRYPTO_get_ex_data(&r->ex_data,idx)); 246. } ^ 247. 248. int RSA_size(const RSA *r) crypto/engine/hw_4758_cca.c:724:2: 722. unsigned char *hashBuffer = NULL; 723. unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx); 724. > long length = SSL_SIG_LEN; 725. long keyLength ; 726. X509_SIG sig; crypto/engine/hw_4758_cca.c:731:2: 729. ASN1_OCTET_STRING digest; 730. 731. > keyTokenLength = *(long*)keyToken; 732. keyToken+=sizeof(long); 733.
https://github.com/openssl/openssl/blob/870694b3da75d0757b400e802caea9d98510b8a4/crypto/engine/hw_4758_cca.c/#L731
d2a_code_trace_data_44976
void CRYPTO_free(void *str) { #ifndef OPENSSL_NO_CRYPTO_MDEBUG if (call_malloc_debug) { CRYPTO_mem_debug_free(str, 0); free(str); CRYPTO_mem_debug_free(str, 1); } else { free(str); } #else free(str); #endif } crypto/pem/pvkfmt.c:662: error: USE_AFTER_FREE call to `EVP_MD_CTX_free()` eventually accesses memory that was invalidated by call to `free()` on line 656 indirectly during the call to `EVP_DigestInit_ex()`. Showing all 16 steps of the trace crypto/pem/pvkfmt.c:653:24: invalidation part of the trace starts here 651. const unsigned char *pass, int passlen) 652. { 653. EVP_MD_CTX *mctx = EVP_MD_CTX_new(); ^ 654. int rv = 1; 655. if (mctx == NULL crypto/pem/pvkfmt.c:653:24: passed as argument to `EVP_MD_CTX_new` 651. const unsigned char *pass, int passlen) 652. { 653. EVP_MD_CTX *mctx = EVP_MD_CTX_new(); ^ 654. int rv = 1; 655. if (mctx == NULL crypto/pem/pvkfmt.c:653:24: return from call to `EVP_MD_CTX_new` 651. const unsigned char *pass, int passlen) 652. { 653. EVP_MD_CTX *mctx = EVP_MD_CTX_new(); ^ 654. int rv = 1; 655. if (mctx == NULL crypto/pem/pvkfmt.c:653:5: assigned 651. const unsigned char *pass, int passlen) 652. { 653. EVP_MD_CTX *mctx = EVP_MD_CTX_new(); ^ 654. int rv = 1; 655. if (mctx == NULL crypto/pem/pvkfmt.c:656:13: when calling `EVP_DigestInit_ex` here 654. int rv = 1; 655. if (mctx == NULL 656. || !EVP_DigestInit_ex(mctx, EVP_sha1(), NULL) ^ 657. || !EVP_DigestUpdate(mctx, salt, saltlen) 658. || !EVP_DigestUpdate(mctx, pass, passlen) crypto/evp/digest.c:170:1: parameter `ctx` of EVP_DigestInit_ex 168. } 169. 170. > int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) 171. { 172. EVP_MD_CTX_clear_flags(ctx, EVP_MD_CTX_FLAG_CLEANED); crypto/evp/digest.c:229:13: when calling `CRYPTO_free` here 227. if (ctx->digest != type) { 228. if (ctx->digest && ctx->digest->ctx_size) 229. OPENSSL_free(ctx->md_data); ^ 230. ctx->digest = type; 231. if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size) { crypto/mem.c:234:1: parameter `str` of CRYPTO_free 232. } 233. 234. > void CRYPTO_free(void *str) 235. { 236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:245:5: was invalidated by call to `free()` 243. } 244. #else 245. free(str); ^ 246. #endif 247. } crypto/pem/pvkfmt.c:653:24: use-after-lifetime part of the trace starts here 651. const unsigned char *pass, int passlen) 652. { 653. EVP_MD_CTX *mctx = EVP_MD_CTX_new(); ^ 654. int rv = 1; 655. if (mctx == NULL crypto/pem/pvkfmt.c:653:24: passed as argument to `EVP_MD_CTX_new` 651. const unsigned char *pass, int passlen) 652. { 653. EVP_MD_CTX *mctx = EVP_MD_CTX_new(); ^ 654. int rv = 1; 655. if (mctx == NULL crypto/pem/pvkfmt.c:653:24: return from call to `EVP_MD_CTX_new` 651. const unsigned char *pass, int passlen) 652. { 653. EVP_MD_CTX *mctx = EVP_MD_CTX_new(); ^ 654. int rv = 1; 655. if (mctx == NULL crypto/pem/pvkfmt.c:653:5: assigned 651. const unsigned char *pass, int passlen) 652. { 653. EVP_MD_CTX *mctx = EVP_MD_CTX_new(); ^ 654. int rv = 1; 655. if (mctx == NULL crypto/pem/pvkfmt.c:662:5: when calling `EVP_MD_CTX_free` here 660. rv = 0; 661. 662. EVP_MD_CTX_free(mctx); ^ 663. return rv; 664. } crypto/mem.c:234:1: parameter `str` of CRYPTO_free 232. } 233. 234. > void CRYPTO_free(void *str) 235. { 236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:245:5: invalid access occurs here 243. } 244. #else 245. free(str); ^ 246. #endif 247. }
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/mem.c/#L245
d2a_code_trace_data_44977
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecp_oct.c:60: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_sqr`. Showing all 18 steps of the trace crypto/ec/ecp_oct.c:16:1: Parameter `ctx->stack.depth` 14. #include "ec_lcl.h" 15. 16. > int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group, 17. EC_POINT *point, 18. const BIGNUM *x_, int y_bit, crypto/ec/ecp_oct.c:36:5: Call 34. y_bit = (y_bit != 0); 35. 36. BN_CTX_start(ctx); ^ 37. tmp1 = BN_CTX_get(ctx); 38. tmp2 = 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/ec/ecp_oct.c:60:14: Call 58. goto err; 59. } else { 60. if (!BN_mod_sqr(tmp2, x_, group->field, ctx)) ^ 61. goto err; 62. if (!BN_mod_mul(tmp1, tmp2, x_, group->field, ctx)) crypto/bn/bn_mod.c:222:1: Parameter `ctx->stack.depth` 220. } 221. 222. > int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) 223. { 224. if (!BN_sqr(r, a, ctx)) crypto/bn/bn_mod.c:224:10: Call 222. int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) 223. { 224. if (!BN_sqr(r, a, ctx)) ^ 225. return 0; 226. /* r->neg == 0, thus we don't need BN_nnmod */ crypto/bn/bn_sqr.c:17:1: Parameter `ctx->stack.depth` 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 ret = bn_sqr_fixed_top(r, a, ctx); crypto/bn/bn_sqr.c:19:15: Call 17. int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int ret = bn_sqr_fixed_top(r, a, ctx); ^ 20. 21. bn_correct_top(r); crypto/bn/bn_sqr.c:42:5: Call 40. } 41. 42. BN_CTX_start(ctx); ^ 43. rr = (a != r) ? r : BN_CTX_get(ctx); 44. 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_sqr.c:104:5: Call 102. bn_check_top(rr); 103. bn_check_top(tmp); 104. BN_CTX_end(ctx); ^ 105. return ret; 106. } 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_mod_sqr` 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_44978
int test_div(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *c, *d, *e; int i; a = BN_new(); b = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); BN_one(a); BN_zero(b); if (BN_div(d, c, a, b, ctx)) { fprintf(stderr, "Division by zero succeeded!\n"); return 0; } for (i = 0; i < num0 + num1; i++) { if (i < num1) { BN_bntest_rand(a, 400, 0, 0); BN_copy(b, a); BN_lshift(a, a, i); BN_add_word(a, i); } else BN_bntest_rand(b, 50 + 3 * (i - num1), 0, 0); a->neg = rand_neg(); b->neg = rand_neg(); BN_div(d, c, a, b, ctx); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " / "); BN_print(bp, b); BIO_puts(bp, " - "); } BN_print(bp, d); BIO_puts(bp, "\n"); if (!results) { BN_print(bp, a); BIO_puts(bp, " % "); BN_print(bp, b); BIO_puts(bp, " - "); } BN_print(bp, c); BIO_puts(bp, "\n"); } BN_mul(e, d, b, ctx); BN_add(d, e, c); BN_sub(d, d, a); if (!BN_is_zero(d)) { fprintf(stderr, "Division test failed!\n"); return 0; } } BN_free(a); BN_free(b); BN_free(c); BN_free(d); BN_free(e); return (1); } test/bntest.c:498: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 446, column 9 is not reachable after line 498, column 5. Showing all 173 steps of the trace test/bntest.c:439:1: start of procedure test_div() 437. } 438. 439. > int test_div(BIO *bp, BN_CTX *ctx) 440. { 441. BIGNUM *a, *b, *c, *d, *e; test/bntest.c:444:5: 442. int i; 443. 444. > a = BN_new(); 445. b = BN_new(); 446. 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:445:5: 443. 444. a = BN_new(); 445. > b = BN_new(); 446. c = BN_new(); 447. 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:446:5: 444. a = BN_new(); 445. b = BN_new(); 446. > c = BN_new(); 447. d = BN_new(); 448. 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:447:5: 445. b = BN_new(); 446. c = BN_new(); 447. > d = BN_new(); 448. e = BN_new(); 449. 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:448:5: 446. c = BN_new(); 447. d = BN_new(); 448. > e = BN_new(); 449. 450. BN_one(a); 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:450:5: 448. e = BN_new(); 449. 450. > BN_one(a); 451. BN_zero(b); 452. crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is true 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:451:5: 449. 450. BN_one(a); 451. > BN_zero(b); 452. 453. if (BN_div(d, c, a, b, ctx)) { crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is false 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:453:9: Taking false branch 451. BN_zero(b); 452. 453. if (BN_div(d, c, a, b, ctx)) { ^ 454. fprintf(stderr, "Division by zero succeeded!\n"); 455. return 0; test/bntest.c:458:10: 456. } 457. 458. > for (i = 0; i < num0 + num1; i++) { 459. if (i < num1) { 460. BN_bntest_rand(a, 400, 0, 0); test/bntest.c:458:17: Loop condition is false. Leaving loop 456. } 457. 458. for (i = 0; i < num0 + num1; i++) { ^ 459. if (i < num1) { 460. BN_bntest_rand(a, 400, 0, 0); test/bntest.c:496:5: 494. } 495. } 496. > BN_free(a); 497. BN_free(b); 498. BN_free(c); 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:497:5: 495. } 496. BN_free(a); 497. > BN_free(b); 498. BN_free(c); 499. BN_free(d); 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:498:5: 496. BN_free(a); 497. BN_free(b); 498. > BN_free(c); 499. BN_free(d); 500. BN_free(e); 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/#L498
d2a_code_trace_data_44979
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecdsa_ossl.c:243: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `bn_to_mont_fixed_top`. Showing all 15 steps of the trace crypto/ec/ecdsa_ossl.c:223:18: Call 221. do { 222. if (in_kinv == NULL || in_r == NULL) { 223. if (!ecdsa_sign_setup(eckey, ctx, &kinv, &ret->r, dgst, dgst_len)) { ^ 224. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_ECDSA_LIB); 225. goto err; crypto/ec/ecdsa_ossl.c:33:1: Parameter `ctx_in->stack.depth` 31. } 32. 33. > static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, 34. BIGNUM **kinvp, BIGNUM **rp, 35. const unsigned char *dgst, int dlen) crypto/ec/ecdsa_ossl.c:243:14: Call 241. * below, returns user-visible value with removed zero padding. 242. */ 243. if (!bn_to_mont_fixed_top(s, ret->r, group->mont_data, ctx) ^ 244. || !bn_mul_mont_fixed_top(s, s, priv_key, group->mont_data, ctx)) { 245. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); crypto/bn/bn_mont.c:210:1: Parameter `ctx->stack.depth` 208. } 209. 210. > int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 211. BN_CTX *ctx) 212. { crypto/bn/bn_mont.c:213:12: Call 211. BN_CTX *ctx) 212. { 213. return bn_mul_mont_fixed_top(r, a, &(mont->RR), mont, ctx); ^ 214. } 215. crypto/bn/bn_mont.c:60:5: Call 58. return 0; 59. 60. BN_CTX_start(ctx); ^ 61. tmp = BN_CTX_get(ctx); 62. if (tmp == NULL) 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_mont.c:83:5: Call 81. ret = 1; 82. err: 83. BN_CTX_end(ctx); ^ 84. return ret; 85. } 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:274:1: <Offset 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:274:1: <Length 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->indexes` 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: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `bn_to_mont_fixed_top` 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/4cc968df403ed9321d0df722aba33323ae575ce0/crypto/bn/bn_ctx.c/#L276
d2a_code_trace_data_44980
ngx_int_t ngx_http_get_forwarded_addr(ngx_http_request_t *r, ngx_addr_t *addr, ngx_array_t *headers, ngx_str_t *value, ngx_array_t *proxies, int recursive) { ngx_int_t rc; ngx_uint_t i, found; ngx_table_elt_t **h; if (headers == NULL) { return ngx_http_get_forwarded_addr_internal(r, addr, value->data, value->len, proxies, recursive); } i = headers->nelts; h = headers->elts; rc = NGX_DECLINED; found = 0; while (i-- > 0) { rc = ngx_http_get_forwarded_addr_internal(r, addr, h[i]->value.data, h[i]->value.len, proxies, recursive); if (!recursive) { break; } if (rc == NGX_DECLINED && found) { rc = NGX_DONE; break; } if (rc != NGX_OK) { break; } found = 1; } return rc; } src/http/ngx_http_core_module.c:2769: error: Integer Overflow L2 ([0, `headers->nelts`] - 1):unsigned64. src/http/ngx_http_core_module.c:2747:1: <LHS trace> 2745. 2746. 2747. ngx_int_t ^ 2748. ngx_http_get_forwarded_addr(ngx_http_request_t *r, ngx_addr_t *addr, 2749. ngx_array_t *headers, ngx_str_t *value, ngx_array_t *proxies, src/http/ngx_http_core_module.c:2747:1: Parameter `headers->nelts` 2745. 2746. 2747. ngx_int_t ^ 2748. ngx_http_get_forwarded_addr(ngx_http_request_t *r, ngx_addr_t *addr, 2749. ngx_array_t *headers, ngx_str_t *value, ngx_array_t *proxies, src/http/ngx_http_core_module.c:2762:5: Assignment 2760. } 2761. 2762. i = headers->nelts; ^ 2763. h = headers->elts; 2764. src/http/ngx_http_core_module.c:2769:12: Binary operation: ([0, headers->nelts] - 1):unsigned64 2767. found = 0; 2768. 2769. while (i-- > 0) { ^ 2770. rc = ngx_http_get_forwarded_addr_internal(r, addr, h[i]->value.data, 2771. h[i]->value.len, proxies,
https://github.com/nginx/nginx/blob/8ca4dff8c89b1b7260aad559f315bdd601c1c79a/src/http/ngx_http_core_module.c/#L2769
d2a_code_trace_data_44981
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:341: error: BUFFER_OVERRUN_L2 Offset: [-15, 536870911] (⇐ [0, 1] + [-15, 536870910]) Size: 9 by call to `BN_hex2bn`. Showing all 7 steps of the trace test/params_test.c:341:10: Call 339. app_p1 = app_p1_init; 340. app_p2 = app_p2_init; 341. if (!BN_hex2bn(&app_p3, app_p3_init) ^ 342. || (l = BN_bn2nativepad(app_p3, bignumbin, sizeof(bignumbin))) < 0) 343. return 0; 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:164:5: Assignment 162. goto err; 163. 164. j = i; /* least significant 'hex' */ ^ 165. m = 0; 166. h = 0; 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:171:17: Array access: Offset: [-15, 536870911] (⇐ [0, 1] + [-15, 536870910]) Size: 9 by call to `BN_hex2bn` 169. l = 0; 170. for (;;) { 171. c = a[j - m]; ^ 172. k = OPENSSL_hexchar2int(c); 173. if (k < 0)
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_print.c/#L171
d2a_code_trace_data_44982
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); } ssl/statem/statem_clnt.c:1999: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->initial_ctx->sessions->num_items`)] - 1):unsigned64 by call to `ssl3_send_alert`. Showing all 13 steps of the trace ssl/statem/statem_clnt.c:1825:1: Parameter `s->initial_ctx->sessions->num_items` 1823. } 1824. 1825. > MSG_PROCESS_RETURN tls_process_key_exchange(SSL *s, PACKET *pkt) 1826. { 1827. int al = -1, ispss = 0; ssl/statem/statem_clnt.c:1999:9: Call 1997. err: 1998. if (al != -1) 1999. ssl3_send_alert(s, SSL3_AL_FATAL, al); ^ 2000. ossl_statem_set_error(s); 2001. EVP_MD_CTX_free(md_ctx); ssl/s3_msg.c:63:1: Parameter `s->initial_ctx->sessions->num_items` 61. } 62. 63. > int ssl3_send_alert(SSL *s, int level, int desc) 64. { 65. /* Map tls/ssl alert value to correct one */ ssl/s3_msg.c:74:9: Call 72. /* If a fatal one, remove from cache */ 73. if ((level == SSL3_AL_FATAL) && (s->session != NULL)) 74. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 75. 76. s->s3->alert_dispatch = 1; ssl/ssl_sess.c:715:1: Parameter `ctx->sessions->num_items` 713. } 714. 715. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 716. { 717. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:717:12: Call 715. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 716. { 717. return remove_session_lock(ctx, c, 1); ^ 718. } 719. ssl/ssl_sess.c:720:1: Parameter `ctx->sessions->num_items` 718. } 719. 720. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 721. { 722. SSL_SESSION *r; ssl/ssl_sess.c:730:17: Call 728. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 729. ret = 1; 730. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 731. SSL_SESSION_list_remove(ctx, c); 732. } ssl/ssl_locl.h:608:1: Parameter `lh->num_items` 606. }; 607. 608. > DEFINE_LHASH_OF(SSL_SESSION); 609. /* Needed in ssl_cert.c */ 610. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:608:1: Call 606. }; 607. 608. > DEFINE_LHASH_OF(SSL_SESSION); 609. /* Needed in ssl_cert.c */ 610. 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, max(0, s->initial_ctx->sessions->num_items)] - 1):unsigned64 by call to `ssl3_send_alert` 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/adb403dea90cd3e2fb028bb16d44364a7b5d75d1/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_44983
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_x931p.c:86: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mul`. Showing all 14 steps of the trace crypto/bn/bn_x931p.c:83:10: Call 81. goto err; 82. 83. if (!bn_x931_derive_pi(p2, Xp2, ctx, cb)) ^ 84. goto err; 85. crypto/bn/bn_x931p.c:21:1: Parameter `ctx->stack.depth` 19. */ 20. 21. > static int bn_x931_derive_pi(BIGNUM *pi, const BIGNUM *Xpi, BN_CTX *ctx, 22. BN_GENCB *cb) 23. { crypto/bn/bn_x931p.c:86:10: Call 84. goto err; 85. 86. if (!BN_mul(p1p2, p1, p2, ctx)) ^ 87. goto err; 88. 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 = bn_mul_fixed_top(r, a, b, ctx); crypto/bn/bn_mul.c:499:15: Call 497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); ^ 500. 501. bn_correct_top(r); crypto/bn/bn_mul.c:507:1: Parameter `ctx->stack.depth` 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:533:5: Call 531. top = al + bl; 532. 533. BN_CTX_start(ctx); ^ 534. if ((r == a) || (r == b)) { 535. if ((rr = BN_CTX_get(ctx)) == NULL) 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_mul.c:618:5: Call 616. err: 617. bn_check_top(r); 618. BN_CTX_end(ctx); ^ 619. return ret; 620. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 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: <LHS 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:268:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_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/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_44984
static ngx_buf_t * ngx_http_autoindex_html(ngx_http_request_t *r, ngx_array_t *entries) { u_char *last, scale; off_t length; size_t len, char_len, escape_html; ngx_tm_t tm; ngx_buf_t *b; ngx_int_t size; ngx_uint_t i, utf8; ngx_time_t *tp; ngx_http_autoindex_entry_t *entry; ngx_http_autoindex_loc_conf_t *alcf; static u_char title[] = "<html>" CRLF "<head><title>Index of " ; static u_char header[] = "</title></head>" CRLF "<body>" CRLF "<h1>Index of " ; static u_char tail[] = "</body>" CRLF "</html>" CRLF ; static char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; if (r->headers_out.charset.len == 5 && ngx_strncasecmp(r->headers_out.charset.data, (u_char *) "utf-8", 5) == 0) { utf8 = 1; } else { utf8 = 0; } escape_html = ngx_escape_html(NULL, r->uri.data, r->uri.len); len = sizeof(title) - 1 + r->uri.len + escape_html + sizeof(header) - 1 + r->uri.len + escape_html + sizeof("</h1>") - 1 + sizeof("<hr><pre><a href=\"../\">../</a>" CRLF) - 1 + sizeof("</pre><hr>") - 1 + sizeof(tail) - 1; entry = entries->elts; for (i = 0; i < entries->nelts; i++) { entry[i].escape = 2 * ngx_escape_uri(NULL, entry[i].name.data, entry[i].name.len, NGX_ESCAPE_URI_COMPONENT); entry[i].escape_html = ngx_escape_html(NULL, entry[i].name.data, entry[i].name.len); if (utf8) { entry[i].utf_len = ngx_utf8_length(entry[i].name.data, entry[i].name.len); } else { entry[i].utf_len = entry[i].name.len; } len += sizeof("<a href=\"") - 1 + entry[i].name.len + entry[i].escape + 1 + sizeof("\">") - 1 + entry[i].name.len - entry[i].utf_len + entry[i].escape_html + NGX_HTTP_AUTOINDEX_NAME_LEN + sizeof("&gt;") - 2 + sizeof("</a>") - 1 + sizeof(" 28-Sep-1970 12:00 ") - 1 + 20 + 2; } b = ngx_create_temp_buf(r->pool, len); if (b == NULL) { return NULL; } b->last = ngx_cpymem(b->last, title, sizeof(title) - 1); if (escape_html) { b->last = (u_char *) ngx_escape_html(b->last, r->uri.data, r->uri.len); b->last = ngx_cpymem(b->last, header, sizeof(header) - 1); b->last = (u_char *) ngx_escape_html(b->last, r->uri.data, r->uri.len); } else { b->last = ngx_cpymem(b->last, r->uri.data, r->uri.len); b->last = ngx_cpymem(b->last, header, sizeof(header) - 1); b->last = ngx_cpymem(b->last, r->uri.data, r->uri.len); } b->last = ngx_cpymem(b->last, "</h1>", sizeof("</h1>") - 1); b->last = ngx_cpymem(b->last, "<hr><pre><a href=\"../\">../</a>" CRLF, sizeof("<hr><pre><a href=\"../\">../</a>" CRLF) - 1); alcf = ngx_http_get_module_loc_conf(r, ngx_http_autoindex_module); tp = ngx_timeofday(); for (i = 0; i < entries->nelts; i++) { b->last = ngx_cpymem(b->last, "<a href=\"", sizeof("<a href=\"") - 1); if (entry[i].escape) { ngx_escape_uri(b->last, entry[i].name.data, entry[i].name.len, NGX_ESCAPE_URI_COMPONENT); b->last += entry[i].name.len + entry[i].escape; } else { b->last = ngx_cpymem(b->last, entry[i].name.data, entry[i].name.len); } if (entry[i].dir) { *b->last++ = '/'; } *b->last++ = '"'; *b->last++ = '>'; len = entry[i].utf_len; if (entry[i].name.len != len) { if (len > NGX_HTTP_AUTOINDEX_NAME_LEN) { char_len = NGX_HTTP_AUTOINDEX_NAME_LEN - 3 + 1; } else { char_len = NGX_HTTP_AUTOINDEX_NAME_LEN + 1; } last = b->last; b->last = ngx_utf8_cpystrn(b->last, entry[i].name.data, char_len, entry[i].name.len + 1); if (entry[i].escape_html) { b->last = (u_char *) ngx_escape_html(last, entry[i].name.data, b->last - last); } last = b->last; } else { if (entry[i].escape_html) { if (len > NGX_HTTP_AUTOINDEX_NAME_LEN) { char_len = NGX_HTTP_AUTOINDEX_NAME_LEN - 3; } else { char_len = len; } b->last = (u_char *) ngx_escape_html(b->last, entry[i].name.data, char_len); last = b->last; } else { b->last = ngx_cpystrn(b->last, entry[i].name.data, NGX_HTTP_AUTOINDEX_NAME_LEN + 1); last = b->last - 3; } } if (len > NGX_HTTP_AUTOINDEX_NAME_LEN) { b->last = ngx_cpymem(last, "..&gt;</a>", sizeof("..&gt;</a>") - 1); } else { if (entry[i].dir && NGX_HTTP_AUTOINDEX_NAME_LEN - len > 0) { *b->last++ = '/'; len++; } b->last = ngx_cpymem(b->last, "</a>", sizeof("</a>") - 1); if (NGX_HTTP_AUTOINDEX_NAME_LEN - len > 0) { ngx_memset(b->last, ' ', NGX_HTTP_AUTOINDEX_NAME_LEN - len); b->last += NGX_HTTP_AUTOINDEX_NAME_LEN - len; } } *b->last++ = ' '; ngx_gmtime(entry[i].mtime + tp->gmtoff * 60 * alcf->localtime, &tm); b->last = ngx_sprintf(b->last, "%02d-%s-%d %02d:%02d ", tm.ngx_tm_mday, months[tm.ngx_tm_mon - 1], tm.ngx_tm_year, tm.ngx_tm_hour, tm.ngx_tm_min); if (alcf->exact_size) { if (entry[i].dir) { b->last = ngx_cpymem(b->last, " -", sizeof(" -") - 1); } else { b->last = ngx_sprintf(b->last, "%19O", entry[i].size); } } else { if (entry[i].dir) { b->last = ngx_cpymem(b->last, " -", sizeof(" -") - 1); } else { length = entry[i].size; if (length > 1024 * 1024 * 1024 - 1) { size = (ngx_int_t) (length / (1024 * 1024 * 1024)); if ((length % (1024 * 1024 * 1024)) > (1024 * 1024 * 1024 / 2 - 1)) { size++; } scale = 'G'; } else if (length > 1024 * 1024 - 1) { size = (ngx_int_t) (length / (1024 * 1024)); if ((length % (1024 * 1024)) > (1024 * 1024 / 2 - 1)) { size++; } scale = 'M'; } else if (length > 9999) { size = (ngx_int_t) (length / 1024); if (length % 1024 > 511) { size++; } scale = 'K'; } else { size = (ngx_int_t) length; scale = '\0'; } if (scale) { b->last = ngx_sprintf(b->last, "%6i%c", size, scale); } else { b->last = ngx_sprintf(b->last, " %6i", size); } } } *b->last++ = CR; *b->last++ = LF; } b->last = ngx_cpymem(b->last, "</pre><hr>", sizeof("</pre><hr>") - 1); b->last = ngx_cpymem(b->last, tail, sizeof(tail) - 1); return b; } src/http/modules/ngx_http_autoindex_module.c:531: error: Buffer Overrun L3 Offset added: 38 Size: [0, +oo]. src/http/modules/ngx_http_autoindex_module.c:522:5: <Length trace> 520. } 521. 522. b->last = ngx_cpymem(b->last, title, sizeof(title) - 1); ^ 523. 524. if (escape_html) { src/http/modules/ngx_http_autoindex_module.c:522:5: Assignment 520. } 521. 522. b->last = ngx_cpymem(b->last, title, sizeof(title) - 1); ^ 523. 524. if (escape_html) { src/http/modules/ngx_http_autoindex_module.c:531:19: Array access: Offset added: 38 Size: [0, +oo] 529. } else { 530. b->last = ngx_cpymem(b->last, r->uri.data, r->uri.len); 531. b->last = ngx_cpymem(b->last, header, sizeof(header) - 1); ^ 532. b->last = ngx_cpymem(b->last, r->uri.data, r->uri.len); 533. }
https://github.com/nginx/nginx/blob/1065455289d72b140f9e63a420b531eaae2d4039/src/http/modules/ngx_http_autoindex_module.c/#L531
d2a_code_trace_data_44985
static CONF_MODULE *module_add(DSO *dso, const char *name, conf_init_func *ifunc, conf_finish_func *ffunc) { CONF_MODULE *tmod = NULL; if (supported_modules == NULL) supported_modules = sk_CONF_MODULE_new_null(); if (supported_modules == NULL) return NULL; tmod = OPENSSL_zalloc(sizeof(*tmod)); if (tmod == NULL) return NULL; tmod->dso = dso; tmod->name = OPENSSL_strdup(name); tmod->init = ifunc; tmod->finish = ffunc; if (!sk_CONF_MODULE_push(supported_modules, tmod)) { OPENSSL_free(tmod); return NULL; } return tmod; } crypto/conf/conf_mod.c:294: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_strdup()` at line 289, column 18 is not reachable after line 294, column 9. Showing all 68 steps of the trace crypto/conf/conf_mod.c:276:1: start of procedure module_add() 274. 275. /* add module to list */ 276. > static CONF_MODULE *module_add(DSO *dso, const char *name, 277. conf_init_func *ifunc, conf_finish_func *ffunc) 278. { crypto/conf/conf_mod.c:279:5: 277. conf_init_func *ifunc, conf_finish_func *ffunc) 278. { 279. > CONF_MODULE *tmod = NULL; 280. if (supported_modules == NULL) 281. supported_modules = sk_CONF_MODULE_new_null(); crypto/conf/conf_mod.c:280:9: Taking false branch 278. { 279. CONF_MODULE *tmod = NULL; 280. if (supported_modules == NULL) ^ 281. supported_modules = sk_CONF_MODULE_new_null(); 282. if (supported_modules == NULL) crypto/conf/conf_mod.c:282:9: Taking false branch 280. if (supported_modules == NULL) 281. supported_modules = sk_CONF_MODULE_new_null(); 282. if (supported_modules == NULL) ^ 283. return NULL; 284. tmod = OPENSSL_zalloc(sizeof(*tmod)); crypto/conf/conf_mod.c:284:5: 282. if (supported_modules == NULL) 283. return NULL; 284. > tmod = OPENSSL_zalloc(sizeof(*tmod)); 285. if (tmod == NULL) 286. 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/conf/conf_mod.c:285:9: Taking false branch 283. return NULL; 284. tmod = OPENSSL_zalloc(sizeof(*tmod)); 285. if (tmod == NULL) ^ 286. return NULL; 287. crypto/conf/conf_mod.c:288:5: 286. return NULL; 287. 288. > tmod->dso = dso; 289. tmod->name = OPENSSL_strdup(name); 290. tmod->init = ifunc; crypto/conf/conf_mod.c:289:5: 287. 288. tmod->dso = dso; 289. > tmod->name = OPENSSL_strdup(name); 290. tmod->init = ifunc; 291. tmod->finish = ffunc; crypto/o_str.c:121:1: start of procedure CRYPTO_strdup() 119. } 120. 121. > char *CRYPTO_strdup(const char *str, const char* file, int line) 122. { 123. char *ret; crypto/o_str.c:125:9: Taking false branch 123. char *ret; 124. 125. if (str == NULL) ^ 126. return NULL; 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); crypto/o_str.c:127:5: 125. if (str == NULL) 126. return NULL; 127. > ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) 129. strcpy(ret, str); 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/o_str.c:128:9: Taking true branch 126. return NULL; 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) ^ 129. strcpy(ret, str); 130. return ret; crypto/o_str.c:129:9: 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) 129. > strcpy(ret, str); 130. return ret; 131. } crypto/o_str.c:130:5: 128. if (ret != NULL) 129. strcpy(ret, str); 130. > return ret; 131. } 132. crypto/o_str.c:131:1: return from a call to CRYPTO_strdup 129. strcpy(ret, str); 130. return ret; 131. > } 132. 133. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line) crypto/conf/conf_mod.c:290:5: 288. tmod->dso = dso; 289. tmod->name = OPENSSL_strdup(name); 290. > tmod->init = ifunc; 291. tmod->finish = ffunc; 292. crypto/conf/conf_mod.c:291:5: 289. tmod->name = OPENSSL_strdup(name); 290. tmod->init = ifunc; 291. > tmod->finish = ffunc; 292. 293. if (!sk_CONF_MODULE_push(supported_modules, tmod)) { crypto/conf/conf_mod.c:293:10: 291. tmod->finish = ffunc; 292. 293. > if (!sk_CONF_MODULE_push(supported_modules, tmod)) { 294. OPENSSL_free(tmod); 295. return NULL; include/openssl/conf.h:105:1: start of procedure sk_CONF_MODULE_push() 103. typedef struct conf_module_st CONF_MODULE; 104. 105. > DEFINE_STACK_OF(CONF_MODULE) 106. DEFINE_STACK_OF(CONF_IMODULE) 107. crypto/stack/stack.c:259:1: start of procedure sk_push() 257. } 258. 259. > int sk_push(_STACK *st, void *data) 260. { 261. return (sk_insert(st, data, st->num)); crypto/stack/stack.c:261:5: 259. int sk_push(_STACK *st, void *data) 260. { 261. > return (sk_insert(st, data, st->num)); 262. } 263. crypto/stack/stack.c:167:1: start of procedure sk_insert() 165. } 166. 167. > int sk_insert(_STACK *st, void *data, int loc) 168. { 169. char **s; crypto/stack/stack.c:171:9: Taking false branch 169. char **s; 170. 171. if (st == NULL) ^ 172. return 0; 173. if (st->num_alloc <= st->num + 1) { crypto/stack/stack.c:173:9: Taking true branch 171. if (st == NULL) 172. return 0; 173. if (st->num_alloc <= st->num + 1) { ^ 174. s = OPENSSL_realloc((char *)st->data, 175. (unsigned int)sizeof(char *) * st->num_alloc * 2); crypto/stack/stack.c:174:9: 172. return 0; 173. if (st->num_alloc <= st->num + 1) { 174. > s = OPENSSL_realloc((char *)st->data, 175. (unsigned int)sizeof(char *) * st->num_alloc * 2); 176. if (s == NULL) crypto/mem.c:166:1: start of procedure CRYPTO_realloc() 164. } 165. 166. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) 167. { 168. if (str == NULL) crypto/mem.c:168:9: Taking true branch 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) 167. { 168. if (str == NULL) ^ 169. return CRYPTO_malloc(num, file, line); 170. crypto/mem.c:169:9: 167. { 168. if (str == NULL) 169. > return CRYPTO_malloc(num, file, line); 170. 171. if (num == 0) { 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 true branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:125:9: 123. 124. if (num <= 0) 125. > return NULL; 126. 127. allow_customize = 0; 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:191:1: return from a call to CRYPTO_realloc 189. return realloc(str, num); 190. 191. > } 192. 193. void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num, crypto/stack/stack.c:176:13: Taking true branch 174. s = OPENSSL_realloc((char *)st->data, 175. (unsigned int)sizeof(char *) * st->num_alloc * 2); 176. if (s == NULL) ^ 177. return (0); 178. st->data = s; crypto/stack/stack.c:177:13: 175. (unsigned int)sizeof(char *) * st->num_alloc * 2); 176. if (s == NULL) 177. > return (0); 178. st->data = s; 179. st->num_alloc *= 2; crypto/stack/stack.c:191:1: return from a call to sk_insert 189. st->sorted = 0; 190. return (st->num); 191. > } 192. 193. void *sk_delete_ptr(_STACK *st, void *p) crypto/stack/stack.c:262:1: return from a call to sk_push 260. { 261. return (sk_insert(st, data, st->num)); 262. > } 263. 264. int sk_unshift(_STACK *st, void *data) include/openssl/conf.h:105:1: return from a call to sk_CONF_MODULE_push 103. typedef struct conf_module_st CONF_MODULE; 104. 105. > DEFINE_STACK_OF(CONF_MODULE) 106. DEFINE_STACK_OF(CONF_IMODULE) 107. crypto/conf/conf_mod.c:293:10: Taking true branch 291. tmod->finish = ffunc; 292. 293. if (!sk_CONF_MODULE_push(supported_modules, tmod)) { ^ 294. OPENSSL_free(tmod); 295. return NULL; crypto/conf/conf_mod.c:294:9: 292. 293. if (!sk_CONF_MODULE_push(supported_modules, tmod)) { 294. > OPENSSL_free(tmod); 295. return NULL; 296. } crypto/mem.c:234:1: start of procedure CRYPTO_free() 232. } 233. 234. > void CRYPTO_free(void *str) 235. { 236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:245:5: 243. } 244. #else 245. > free(str); 246. #endif 247. } crypto/mem.c:247:1: return from a call to CRYPTO_free 245. free(str); 246. #endif 247. > } 248. 249. void CRYPTO_clear_free(void *str, size_t num)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/conf/conf_mod.c/#L294
d2a_code_trace_data_44986
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_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:3636: error: Null Dereference pointer `st` last assigned on line 3630 could be null and is dereferenced at line 3636, column 20. ffmpeg.c:3622:1: start of procedure new_subtitle_stream() 3620. } 3621. 3622. static void new_subtitle_stream(AVFormatContext *oc, int file_idx) ^ 3623. { 3624. AVStream *st; ffmpeg.c:3626:5: 3624. AVStream *st; 3625. AVOutputStream *ost; 3626. AVCodec *codec=NULL; ^ 3627. AVCodecContext *subtitle_enc; 3628. enum CodecID codec_id = CODEC_ID_NONE; ffmpeg.c:3628:5: 3626. AVCodec *codec=NULL; 3627. AVCodecContext *subtitle_enc; 3628. enum CodecID codec_id = CODEC_ID_NONE; ^ 3629. 3630. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ffmpeg.c:3630:28: Condition is true 3628. enum CodecID codec_id = CODEC_ID_NONE; 3629. 3630. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3631. if (!st) { 3632. fprintf(stderr, "Could not alloc stream\n"); ffmpeg.c:3630:5: 3628. enum CodecID codec_id = CODEC_ID_NONE; 3629. 3630. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3631. if (!st) { 3632. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2585:1: start of procedure av_new_stream() 2583. } 2584. 2585. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2586. { 2587. AVStream *st; libavformat/utils.c:2591:9: Taking true branch 2589. AVStream **streams; 2590. 2591. if (s->nb_streams >= INT_MAX/sizeof(*streams)) ^ 2592. return NULL; 2593. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); libavformat/utils.c:2592:9: 2590. 2591. if (s->nb_streams >= INT_MAX/sizeof(*streams)) 2592. return NULL; ^ 2593. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); 2594. if (!streams) libavformat/utils.c:2634:1: return from a call to av_new_stream 2632. s->streams[s->nb_streams++] = st; 2633. return st; 2634. } ^ 2635. 2636. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:3631:10: Taking true branch 3629. 3630. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3631. if (!st) { ^ 3632. fprintf(stderr, "Could not alloc stream\n"); 3633. ffmpeg_exit(1); ffmpeg.c:3632:9: 3630. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3631. if (!st) { 3632. fprintf(stderr, "Could not alloc stream\n"); ^ 3633. ffmpeg_exit(1); 3634. } ffmpeg.c:3633:9: Skipping ffmpeg_exit(): empty list of specs 3631. if (!st) { 3632. fprintf(stderr, "Could not alloc stream\n"); 3633. ffmpeg_exit(1); ^ 3634. } 3635. ost = new_output_stream(oc, file_idx); ffmpeg.c:3635:5: Skipping new_output_stream(): empty list of specs 3633. ffmpeg_exit(1); 3634. } 3635. ost = new_output_stream(oc, file_idx); ^ 3636. subtitle_enc = st->codec; 3637. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); ffmpeg.c:3636:5: 3634. } 3635. ost = new_output_stream(oc, file_idx); 3636. subtitle_enc = st->codec; ^ 3637. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); 3638. if(!subtitle_stream_copy){
https://github.com/libav/libav/blob/b568d6d94bda607e4ebb35be68181a8c2a9f5c50/ffmpeg.c/#L3636
d2a_code_trace_data_44987
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1876: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_div`. Showing all 10 steps of the trace test/bntest.c:1876:9: Call 1874. BN_zero(zero); 1875. 1876. if (BN_div(a, b, BN_value_one(), zero, ctx)) { ^ 1877. fprintf(stderr, "Division by zero succeeded!\n"); 1878. goto err; crypto/bn/bn_div.c:140:1: Parameter `ctx->stack.depth` 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:193:5: Call 191. } 192. 193. BN_CTX_start(ctx); ^ 194. tmp = BN_CTX_get(ctx); 195. snum = 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/bn/bn_div.c:416:5: Call 414. if (no_branch) 415. bn_correct_top(res); 416. BN_CTX_end(ctx); ^ 417. return (1); 418. err: 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_div` 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_44988
static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) { const char *codec_string = encoder ? "encoder" : "decoder"; AVCodec *codec; if(!name) return CODEC_ID_NONE; codec = encoder ? avcodec_find_encoder_by_name(name) : avcodec_find_decoder_by_name(name); if(!codec) { fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); ffmpeg_exit(1); } if(codec->type != type) { fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name); ffmpeg_exit(1); } if(codec->capabilities & CODEC_CAP_EXPERIMENTAL && strict > FF_COMPLIANCE_EXPERIMENTAL) { fprintf(stderr, "%s '%s' is experimental and might produce bad " "results.\nAdd '-strict experimental' if you want to use it.\n", codec_string, codec->name); codec = encoder ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id); if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL)) fprintf(stderr, "Or use the non experimental %s '%s'.\n", codec_string, codec->name); ffmpeg_exit(1); } return codec->id; } ffmpeg.c:3121: error: Null Dereference pointer `codec` last assigned on line 3114 could be null and is dereferenced at line 3121, column 8. ffmpeg.c:3107:1: start of procedure find_codec_or_die() 3105. } 3106. 3107. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) ^ 3108. { 3109. const char *codec_string = encoder ? "encoder" : "decoder"; ffmpeg.c:3109:32: Condition is true 3107. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) 3108. { 3109. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 3110. AVCodec *codec; 3111. ffmpeg.c:3109:5: 3107. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) 3108. { 3109. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 3110. AVCodec *codec; 3111. ffmpeg.c:3112:9: Taking false branch 3110. AVCodec *codec; 3111. 3112. if(!name) ^ 3113. return CODEC_ID_NONE; 3114. codec = encoder ? ffmpeg.c:3114:13: Condition is true 3112. if(!name) 3113. return CODEC_ID_NONE; 3114. codec = encoder ? ^ 3115. avcodec_find_encoder_by_name(name) : 3116. avcodec_find_decoder_by_name(name); ffmpeg.c:3114:5: 3112. if(!name) 3113. return CODEC_ID_NONE; 3114. codec = encoder ? ^ 3115. avcodec_find_encoder_by_name(name) : 3116. avcodec_find_decoder_by_name(name); ffmpeg.c:3117:9: Taking true branch 3115. avcodec_find_encoder_by_name(name) : 3116. avcodec_find_decoder_by_name(name); 3117. if(!codec) { ^ 3118. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); 3119. ffmpeg_exit(1); ffmpeg.c:3118:9: 3116. avcodec_find_decoder_by_name(name); 3117. if(!codec) { 3118. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); ^ 3119. ffmpeg_exit(1); 3120. } ffmpeg.c:3119:9: Skipping ffmpeg_exit(): empty list of specs 3117. if(!codec) { 3118. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); 3119. ffmpeg_exit(1); ^ 3120. } 3121. if(codec->type != type) { ffmpeg.c:3121:8: 3119. ffmpeg_exit(1); 3120. } 3121. if(codec->type != type) { ^ 3122. fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name); 3123. ffmpeg_exit(1);
https://github.com/libav/libav/blob/a6286bda0956bfe15b4e1a9f96e1689666e1d866/ffmpeg.c/#L3121
d2a_code_trace_data_44989
void ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p) { size_t size; uintptr_t slab, m, *bitmap; ngx_uint_t n, type, slot, shift, map; ngx_slab_page_t *slots, *page; ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, ngx_cycle->log, 0, "slab free: %p", p); if ((u_char *) p < pool->start || (u_char *) p > pool->end) { ngx_slab_error(pool, NGX_LOG_ALERT, "ngx_slab_free(): outside of pool"); goto fail; } n = ((u_char *) p - pool->start) >> ngx_pagesize_shift; page = &pool->pages[n]; slab = page->slab; type = page->prev & NGX_SLAB_PAGE_MASK; switch (type) { case NGX_SLAB_SMALL: shift = slab & NGX_SLAB_SHIFT_MASK; size = 1 << shift; if ((uintptr_t) p & (size - 1)) { goto wrong_chunk; } n = ((uintptr_t) p & (ngx_pagesize - 1)) >> shift; m = (uintptr_t) 1 << (n & (sizeof(uintptr_t) * 8 - 1)); n /= (sizeof(uintptr_t) * 8); bitmap = (uintptr_t *) ((uintptr_t) p & ~(ngx_pagesize - 1)); if (bitmap[n] & m) { if (page->next == NULL) { slots = (ngx_slab_page_t *) ((u_char *) pool + sizeof(ngx_slab_pool_t)); slot = shift - pool->min_shift; page->next = slots[slot].next; slots[slot].next = page; page->prev = (uintptr_t) &slots[slot] | NGX_SLAB_SMALL; page->next->prev = (uintptr_t) page | NGX_SLAB_SMALL; } bitmap[n] &= ~m; n = (1 << (ngx_pagesize_shift - shift)) / 8 / (1 << shift); if (n == 0) { n = 1; } if (bitmap[0] & ~(((uintptr_t) 1 << n) - 1)) { goto done; } map = (1 << (ngx_pagesize_shift - shift)) / (sizeof(uintptr_t) * 8); for (n = 1; n < map; n++) { if (bitmap[n]) { goto done; } } ngx_slab_free_pages(pool, page, 1); goto done; } goto chunk_already_free; case NGX_SLAB_EXACT: m = (uintptr_t) 1 << (((uintptr_t) p & (ngx_pagesize - 1)) >> ngx_slab_exact_shift); size = ngx_slab_exact_size; if ((uintptr_t) p & (size - 1)) { goto wrong_chunk; } if (slab & m) { if (slab == NGX_SLAB_BUSY) { slots = (ngx_slab_page_t *) ((u_char *) pool + sizeof(ngx_slab_pool_t)); slot = ngx_slab_exact_shift - pool->min_shift; page->next = slots[slot].next; slots[slot].next = page; page->prev = (uintptr_t) &slots[slot] | NGX_SLAB_EXACT; page->next->prev = (uintptr_t) page | NGX_SLAB_EXACT; } page->slab &= ~m; if (page->slab) { goto done; } ngx_slab_free_pages(pool, page, 1); goto done; } goto chunk_already_free; case NGX_SLAB_BIG: shift = slab & NGX_SLAB_SHIFT_MASK; size = 1 << shift; if ((uintptr_t) p & (size - 1)) { goto wrong_chunk; } m = (uintptr_t) 1 << ((((uintptr_t) p & (ngx_pagesize - 1)) >> shift) + NGX_SLAB_MAP_SHIFT); if (slab & m) { if (page->next == NULL) { slots = (ngx_slab_page_t *) ((u_char *) pool + sizeof(ngx_slab_pool_t)); slot = shift - pool->min_shift; page->next = slots[slot].next; slots[slot].next = page; page->prev = (uintptr_t) &slots[slot] | NGX_SLAB_BIG; page->next->prev = (uintptr_t) page | NGX_SLAB_BIG; } page->slab &= ~m; if (page->slab & NGX_SLAB_MAP_MASK) { goto done; } ngx_slab_free_pages(pool, page, 1); goto done; } goto chunk_already_free; case NGX_SLAB_PAGE: if ((uintptr_t) p & (ngx_pagesize - 1)) { goto wrong_chunk; } if (slab == NGX_SLAB_PAGE_FREE) { ngx_slab_error(pool, NGX_LOG_ALERT, "ngx_slab_free(): page is already free"); goto fail; } if (slab == NGX_SLAB_PAGE_BUSY) { ngx_slab_error(pool, NGX_LOG_ALERT, "ngx_slab_free(): pointer to wrong page"); goto fail; } n = ((u_char *) p - pool->start) >> ngx_pagesize_shift; size = slab & ~NGX_SLAB_PAGE_START; ngx_slab_free_pages(pool, &pool->pages[n], size); ngx_slab_junk(p, size << ngx_pagesize_shift); return; } return; done: ngx_slab_junk(p, size); return; wrong_chunk: ngx_slab_error(pool, NGX_LOG_ALERT, "ngx_slab_free(): pointer to wrong chunk"); goto fail; chunk_already_free: ngx_slab_error(pool, NGX_LOG_ALERT, "ngx_slab_free(): chunk is already free"); fail: return; } src/http/ngx_http_file_cache.c:857: error: Integer Overflow L2 ([0, +oo] - [0, 15]):unsigned64 by call to `ngx_slab_free_locked`. src/http/ngx_http_file_cache.c:857:13: Call 855. ngx_queue_remove(q); 856. ngx_rbtree_delete(cache->rbtree, &fcn->node); 857. ngx_slab_free_locked(cache->shpool, fcn); ^ 858. 859. break; src/core/ngx_slab.c:412:1: <LHS trace> 410. 411. 412. void ^ 413. ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p) 414. { src/core/ngx_slab.c:412:1: Global `ngx_pagesize_shift` 410. 411. 412. void ^ 413. ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p) 414. { src/core/ngx_slab.c:412:1: <RHS trace> 410. 411. 412. void ^ 413. ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p) 414. { src/core/ngx_slab.c:412:1: Parameter `pool->pages->slab` 410. 411. 412. void ^ 413. ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p) 414. { src/core/ngx_slab.c:429:5: Assignment 427. n = ((u_char *) p - pool->start) >> ngx_pagesize_shift; 428. page = &pool->pages[n]; 429. slab = page->slab; ^ 430. type = page->prev & NGX_SLAB_PAGE_MASK; 431. src/core/ngx_slab.c:436:9: Assignment 434. case NGX_SLAB_SMALL: 435. 436. shift = slab & NGX_SLAB_SHIFT_MASK; ^ 437. size = 1 << shift; 438. src/core/ngx_slab.c:464:13: Binary operation: ([0, +oo] - [0, 15]):unsigned64 by call to `ngx_slab_free_locked` 462. bitmap[n] &= ~m; 463. 464. n = (1 << (ngx_pagesize_shift - shift)) / 8 / (1 << shift); ^ 465. 466. if (n == 0) {
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_slab.c/#L464
d2a_code_trace_data_44990
static int nss_keylog_int(const char *prefix, SSL *ssl, const uint8_t *parameter_1, size_t parameter_1_len, const uint8_t *parameter_2, size_t parameter_2_len) { char *out = NULL; char *cursor = NULL; size_t out_len = 0; size_t i; size_t prefix_len; if (ssl->ctx->keylog_callback == NULL) return 1; prefix_len = strlen(prefix); out_len = prefix_len + (2 * parameter_1_len) + (2 * parameter_2_len) + 3; if ((out = cursor = OPENSSL_malloc(out_len)) == NULL) { SSLfatal(ssl, SSL_AD_INTERNAL_ERROR, SSL_F_NSS_KEYLOG_INT, ERR_R_MALLOC_FAILURE); return 0; } strcpy(cursor, prefix); cursor += prefix_len; *cursor++ = ' '; for (i = 0; i < parameter_1_len; i++) { sprintf(cursor, "%02x", parameter_1[i]); cursor += 2; } *cursor++ = ' '; for (i = 0; i < parameter_2_len; i++) { sprintf(cursor, "%02x", parameter_2[i]); cursor += 2; } *cursor = '\0'; ssl->ctx->keylog_callback(ssl, (const char *)out); OPENSSL_clear_free(out, out_len); return 1; } ssl/statem/statem_clnt.c:3042: error: BUFFER_OVERRUN_L3 Offset: 3 Size: [1, 118] by call to `ssl_log_rsa_client_key_exchange`. Showing all 13 steps of the trace ssl/statem/statem_clnt.c:2995:5: Assignment 2993. } 2994. 2995. pmslen = SSL_MAX_MASTER_KEY_LENGTH; ^ 2996. pms = OPENSSL_malloc(pmslen); 2997. if (pms == NULL) { ssl/statem/statem_clnt.c:3042:10: Call 3040. 3041. /* Log the premaster secret, if logging is enabled. */ 3042. if (!ssl_log_rsa_client_key_exchange(s, encdata, enclen, pms, pmslen)) { ^ 3043. /* SSLfatal() already called */ 3044. goto err; ssl/ssl_lib.c:5148:1: Parameter `premaster_len` 5146. } 5147. 5148. > int ssl_log_rsa_client_key_exchange(SSL *ssl, 5149. const uint8_t *encrypted_premaster, 5150. size_t encrypted_premaster_len, ssl/ssl_lib.c:5161:12: Call 5159. 5160. /* We only want the first 8 bytes of the encrypted premaster as a tag. */ 5161. return nss_keylog_int("RSA", ^ 5162. ssl, 5163. encrypted_premaster, ssl/ssl_lib.c:5094:1: <Offset trace> 5092. } 5093. 5094. > static int nss_keylog_int(const char *prefix, 5095. SSL *ssl, 5096. const uint8_t *parameter_1, ssl/ssl_lib.c:5094:1: Parameter `prefix->strlen` 5092. } 5093. 5094. > static int nss_keylog_int(const char *prefix, 5095. SSL *ssl, 5096. const uint8_t *parameter_1, ssl/ssl_lib.c:5094:1: <Length trace> 5092. } 5093. 5094. > static int nss_keylog_int(const char *prefix, 5095. SSL *ssl, 5096. const uint8_t *parameter_1, ssl/ssl_lib.c:5094:1: Parameter `parameter_2_len` 5092. } 5093. 5094. > static int nss_keylog_int(const char *prefix, 5095. SSL *ssl, 5096. const uint8_t *parameter_1, ssl/ssl_lib.c:5119:5: Assignment 5117. */ 5118. prefix_len = strlen(prefix); 5119. out_len = prefix_len + (2 * parameter_1_len) + (2 * parameter_2_len) + 3; ^ 5120. if ((out = cursor = OPENSSL_malloc(out_len)) == NULL) { 5121. SSLfatal(ssl, SSL_AD_INTERNAL_ERROR, SSL_F_NSS_KEYLOG_INT, ssl/ssl_lib.c:5120:25: Call 5118. prefix_len = strlen(prefix); 5119. out_len = prefix_len + (2 * parameter_1_len) + (2 * parameter_2_len) + 3; 5120. if ((out = cursor = OPENSSL_malloc(out_len)) == NULL) { ^ 5121. SSLfatal(ssl, SSL_AD_INTERNAL_ERROR, SSL_F_NSS_KEYLOG_INT, 5122. ERR_R_MALLOC_FAILURE); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); ssl/ssl_lib.c:5120:16: Assignment 5118. prefix_len = strlen(prefix); 5119. out_len = prefix_len + (2 * parameter_1_len) + (2 * parameter_2_len) + 3; 5120. if ((out = cursor = OPENSSL_malloc(out_len)) == NULL) { ^ 5121. SSLfatal(ssl, SSL_AD_INTERNAL_ERROR, SSL_F_NSS_KEYLOG_INT, 5122. ERR_R_MALLOC_FAILURE); ssl/ssl_lib.c:5126:5: Array access: Offset: 3 Size: [1, 118] by call to `ssl_log_rsa_client_key_exchange` 5124. } 5125. 5126. strcpy(cursor, prefix); ^ 5127. cursor += prefix_len; 5128. *cursor++ = ' ';
https://github.com/openssl/openssl/blob/fb9c3ff565aa11b08646e0f9f28fc082ed365cbd/ssl/ssl_lib.c/#L5126
d2a_code_trace_data_44991
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:948: error: Uninitialized Value The value read from xmin was never initialized. libavcodec/motion_est_template.c:948:13: 946. 947. //check(x - dia_size + dir, y + dir,0, a3) 948. CHECK_MV(x - dia_size + dir, y + dir ); ^ 949. } 950.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L948
d2a_code_trace_data_44992
int BN_sub_word(BIGNUM *a, BN_ULONG w) { int i; w &= BN_MASK2; if (!w) return 1; if (BN_is_zero(a) || a->neg) { a->neg=0; i=BN_add_word(a,w); a->neg=1; return(i); } if ((a->top == 1) && (a->d[0] < w)) { a->d[0]=w-a->d[0]; a->neg=1; return(1); } i=0; for (;;) { if (a->d[i] >= w) { a->d[i]-=w; break; } else { a->d[i]=(a->d[i]-w)&BN_MASK2; i++; w=1; } } if ((a->d[i] == 0) && (i == (a->top-1))) a->top--; bn_check_top(a); return(1); } crypto/bn/bn_word.c:181: error: INTEGER_OVERFLOW_L2 ([0, max(4294967295, `*a->d`)] - [1, 4294967295]):unsigned64. Showing all 5 steps of the trace crypto/bn/bn_word.c:153:1: <LHS trace> 151. } 152. 153. > int BN_sub_word(BIGNUM *a, BN_ULONG w) 154. { 155. int i; crypto/bn/bn_word.c:153:1: Parameter `*a->d` 151. } 152. 153. > int BN_sub_word(BIGNUM *a, BN_ULONG w) 154. { 155. int i; crypto/bn/bn_word.c:153:1: <RHS trace> 151. } 152. 153. > int BN_sub_word(BIGNUM *a, BN_ULONG w) 154. { 155. int i; crypto/bn/bn_word.c:153:1: Parameter `*a->d` 151. } 152. 153. > int BN_sub_word(BIGNUM *a, BN_ULONG w) 154. { 155. int i; crypto/bn/bn_word.c:181:4: Binary operation: ([0, max(4294967295, *a->d)] - [1, 4294967295]):unsigned64 179. if (a->d[i] >= w) 180. { 181. a->d[i]-=w; ^ 182. break; 183. }
https://github.com/openssl/openssl/blob/6defae04f3c44087d9129994fa88b4f9271b153f/crypto/bn/bn_word.c/#L181
d2a_code_trace_data_44993
int WPACKET_allocate_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; if (pkt->buf->length > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = (pkt->buf->length == 0) ? DEFAULT_BUF_SIZE : pkt->buf->length * 2; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/t1_lib.c:1101: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + `s->srp_ctx.login->strlen` + `s->tlsext_hostname->strlen` + 31]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 10 steps of the trace ssl/t1_lib.c:1099:14: Call 1097. tls1_get_formatlist(s, &pformats, &num_formats); 1098. 1099. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) ^ 1100. /* Sub-packet for formats extension */ 1101. || !WPACKET_start_sub_packet_u16(pkt) ssl/packet.c:238:1: Parameter `pkt->buf->length` 236. } 237. 238. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 239. { 240. unsigned char *data; ssl/t1_lib.c:1101:21: Call 1099. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) 1100. /* Sub-packet for formats extension */ 1101. || !WPACKET_start_sub_packet_u16(pkt) ^ 1102. || !WPACKET_sub_memcpy_u8(pkt, pformats, num_formats) 1103. || !WPACKET_close(pkt)) { ssl/packet.c:201:1: Parameter `pkt->written` 199. } 200. 201. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 202. { 203. WPACKET_SUB *sub; ssl/packet.c:225:10: Call 223. } 224. 225. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 226. return 0; 227. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + s->srp_ctx.login->strlen + s->tlsext_hostname->strlen + 31]):unsigned64 by call to `WPACKET_start_sub_packet_len__` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27.
https://github.com/openssl/openssl/blob/84d5549e692e63a16fa1b11603e4098fc31746e9/ssl/packet.c/#L25
d2a_code_trace_data_44994
void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords) { BN_ULONG t; int i; bn_wcheck_size(a, nwords); bn_wcheck_size(b, nwords); assert(a != b); assert((condition & (condition - 1)) == 0); assert(sizeof(BN_ULONG) >= sizeof(int)); condition = ((condition - 1) >> (BN_BITS2 - 1)) - 1; t = (a->top ^ b->top) & condition; a->top ^= t; b->top ^= t; t = (a->neg ^ b->neg) & condition; a->neg ^= t; b->neg ^= t; t = ((a->flags ^ b->flags) & BN_FLG_CONSTTIME) & condition; a->flags ^= t; b->flags ^= t; #define BN_CONSTTIME_SWAP(ind) \ do { \ t = (a->d[ind] ^ b->d[ind]) & condition; \ a->d[ind] ^= t; \ b->d[ind] ^= t; \ } while (0) switch (nwords) { default: for (i = 10; i < nwords; i++) BN_CONSTTIME_SWAP(i); case 10: BN_CONSTTIME_SWAP(9); case 9: BN_CONSTTIME_SWAP(8); case 8: BN_CONSTTIME_SWAP(7); case 7: BN_CONSTTIME_SWAP(6); case 6: BN_CONSTTIME_SWAP(5); case 5: BN_CONSTTIME_SWAP(4); case 4: BN_CONSTTIME_SWAP(3); case 3: BN_CONSTTIME_SWAP(2); case 2: BN_CONSTTIME_SWAP(1); case 1: BN_CONSTTIME_SWAP(0); } #undef BN_CONSTTIME_SWAP } crypto/ec/ec_mult.c:306: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `BN_consttime_swap`. Showing all 7 steps of the trace crypto/ec/ec_mult.c:305:16: Call 303. 304. for (i = cardinality_bits - 1; i >= 0; i--) { 305. kbit = BN_is_bit_set(k, i) ^ pbit; ^ 306. EC_POINT_CSWAP(kbit, r, s, group_top, Z_is_one); 307. if (!EC_POINT_add(group, s, r, s, ctx)) crypto/bn/bn_lib.c:642:9: Assignment 640. bn_check_top(a); 641. if (n < 0) 642. return 0; ^ 643. i = n / BN_BITS2; 644. j = n % BN_BITS2; crypto/ec/ec_mult.c:305:9: Assignment 303. 304. for (i = cardinality_bits - 1; i >= 0; i--) { 305. kbit = BN_is_bit_set(k, i) ^ pbit; ^ 306. EC_POINT_CSWAP(kbit, r, s, group_top, Z_is_one); 307. if (!EC_POINT_add(group, s, r, s, ctx)) crypto/ec/ec_mult.c:306:9: Call 304. for (i = cardinality_bits - 1; i >= 0; i--) { 305. kbit = BN_is_bit_set(k, i) ^ pbit; 306. EC_POINT_CSWAP(kbit, r, s, group_top, Z_is_one); ^ 307. if (!EC_POINT_add(group, s, r, s, ctx)) 308. goto err; crypto/bn/bn_lib.c:734:1: <LHS trace> 732. * a and b cannot be the same number 733. */ 734. > void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords) 735. { 736. BN_ULONG t; crypto/bn/bn_lib.c:734:1: Parameter `condition` 732. * a and b cannot be the same number 733. */ 734. > void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords) 735. { 736. BN_ULONG t; crypto/bn/bn_lib.c:746:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `BN_consttime_swap` 744. assert(sizeof(BN_ULONG) >= sizeof(int)); 745. 746. condition = ((condition - 1) >> (BN_BITS2 - 1)) - 1; ^ 747. 748. t = (a->top ^ b->top) & condition;
https://github.com/openssl/openssl/blob/51f3021d974f32539a2727908018664963695b5d/crypto/bn/bn_lib.c/#L746
d2a_code_trace_data_44995
int copyFaxFile(TIFF* tifin, TIFF* tifout) { uint32 row; uint32 linesize = TIFFhowmany8(xsize); uint16 badrun; int ok; tifin->tif_rawdatasize = (tmsize_t)TIFFGetFileSize(tifin); if (tifin->tif_rawdatasize == 0) { TIFFError(tifin->tif_name, "Empty input file"); return (0); } tifin->tif_rawdata = _TIFFmalloc(tifin->tif_rawdatasize); if (tifin->tif_rawdata == NULL) { TIFFError(tifin->tif_name, "Not enough memory"); return (0); } if (!ReadOK(tifin, tifin->tif_rawdata, tifin->tif_rawdatasize)) { TIFFError(tifin->tif_name, "Read error at scanline 0"); return (0); } tifin->tif_rawcp = tifin->tif_rawdata; tifin->tif_rawcc = tifin->tif_rawdatasize; (*tifin->tif_setupdecode)(tifin); (*tifin->tif_predecode)(tifin, (tsample_t) 0); tifin->tif_row = 0; badfaxlines = 0; badfaxrun = 0; _TIFFmemset(refbuf, 0, linesize); row = 0; badrun = 0; while (tifin->tif_rawcc > 0) { ok = (*tifin->tif_decoderow)(tifin, (tdata_t) rowbuf, linesize, 0); if (!ok) { badfaxlines++; badrun++; _TIFFmemcpy(rowbuf, refbuf, linesize); } else { if (badrun > badfaxrun) badfaxrun = badrun; badrun = 0; _TIFFmemcpy(refbuf, rowbuf, linesize); } tifin->tif_row++; if (TIFFWriteScanline(tifout, rowbuf, row, 0) < 0) { fprintf(stderr, "%s: Write error at row %ld.\n", tifout->tif_name, (long) row); break; } row++; if (stretch) { if (TIFFWriteScanline(tifout, rowbuf, row, 0) < 0) { fprintf(stderr, "%s: Write error at row %ld.\n", tifout->tif_name, (long) row); break; } row++; } } if (badrun > badfaxrun) badfaxrun = badrun; _TIFFfree(tifin->tif_rawdata); return (row); } tools/fax2tiff.c:390: error: Memory Leak memory dynamically allocated by call to `_TIFFmalloc()` at line 378, column 23 is not reachable after line 390, column 2. tools/fax2tiff.c:365:1: start of procedure copyFaxFile() 363. } 364. 365. int ^ 366. copyFaxFile(TIFF* tifin, TIFF* tifout) 367. { tools/fax2tiff.c:369:20: Condition is true 367. { 368. uint32 row; 369. uint32 linesize = TIFFhowmany8(xsize); ^ 370. uint16 badrun; 371. int ok; tools/fax2tiff.c:369:2: 367. { 368. uint32 row; 369. uint32 linesize = TIFFhowmany8(xsize); ^ 370. uint16 badrun; 371. int ok; tools/fax2tiff.c:373:2: Skipping __function_pointer__(): unresolved function pointer 371. int ok; 372. 373. tifin->tif_rawdatasize = (tmsize_t)TIFFGetFileSize(tifin); ^ 374. if (tifin->tif_rawdatasize == 0) { 375. TIFFError(tifin->tif_name, "Empty input file"); tools/fax2tiff.c:374:6: Taking false branch 372. 373. tifin->tif_rawdatasize = (tmsize_t)TIFFGetFileSize(tifin); 374. if (tifin->tif_rawdatasize == 0) { ^ 375. TIFFError(tifin->tif_name, "Empty input file"); 376. return (0); tools/fax2tiff.c:378:2: 376. return (0); 377. } 378. tifin->tif_rawdata = _TIFFmalloc(tifin->tif_rawdatasize); ^ 379. if (tifin->tif_rawdata == NULL) { 380. TIFFError(tifin->tif_name, "Not enough memory"); libtiff/tif_unix.c:310:1: start of procedure _TIFFmalloc() 308. #endif 309. 310. void* ^ 311. _TIFFmalloc(tmsize_t s) 312. { libtiff/tif_unix.c:313:13: Taking false branch 311. _TIFFmalloc(tmsize_t s) 312. { 313. if (s == 0) ^ 314. return ((void *) NULL); 315. libtiff/tif_unix.c:316:2: 314. return ((void *) NULL); 315. 316. return (malloc((size_t) s)); ^ 317. } 318. libtiff/tif_unix.c:317:1: return from a call to _TIFFmalloc 315. 316. return (malloc((size_t) s)); 317. } ^ 318. 319. void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz) tools/fax2tiff.c:379:6: Taking false branch 377. } 378. tifin->tif_rawdata = _TIFFmalloc(tifin->tif_rawdatasize); 379. if (tifin->tif_rawdata == NULL) { ^ 380. TIFFError(tifin->tif_name, "Not enough memory"); 381. return (0); tools/fax2tiff.c:383:7: Taking false branch 381. return (0); 382. } 383. if (!ReadOK(tifin, tifin->tif_rawdata, tifin->tif_rawdatasize)) { ^ 384. TIFFError(tifin->tif_name, "Read error at scanline 0"); 385. return (0); tools/fax2tiff.c:387:2: 385. return (0); 386. } 387. tifin->tif_rawcp = tifin->tif_rawdata; ^ 388. tifin->tif_rawcc = tifin->tif_rawdatasize; 389. tools/fax2tiff.c:388:2: 386. } 387. tifin->tif_rawcp = tifin->tif_rawdata; 388. tifin->tif_rawcc = tifin->tif_rawdatasize; ^ 389. 390. (*tifin->tif_setupdecode)(tifin); tools/fax2tiff.c:390:2: Skipping __function_pointer__(): unresolved function pointer 388. tifin->tif_rawcc = tifin->tif_rawdatasize; 389. 390. (*tifin->tif_setupdecode)(tifin); ^ 391. (*tifin->tif_predecode)(tifin, (tsample_t) 0); 392. tifin->tif_row = 0;
https://gitlab.com/libtiff/libtiff/blob/6dac309a9701d15ac52d895d566ddae2ed49db9b/tools/fax2tiff.c/#L390
d2a_code_trace_data_44996
void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){ int i; InternalBuffer *buf, *last; assert(pic->type==FF_BUFFER_TYPE_INTERNAL); assert(s->internal_buffer_count); buf = NULL; for(i=0; i<s->internal_buffer_count; i++){ buf= &((InternalBuffer*)s->internal_buffer)[i]; if(buf->data[0] == pic->data[0]) break; } assert(i < s->internal_buffer_count); s->internal_buffer_count--; last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; FFSWAP(InternalBuffer, *buf, *last); for(i=0; i<4; i++){ pic->data[i]=NULL; } if(s->debug&FF_DEBUG_BUFFERS) av_log(s, AV_LOG_DEBUG, "default_release_buffer called on pic %p, %d buffers used\n", pic, s->internal_buffer_count); } libavcodec/utils.c:380: error: Null Dereference pointer `buf` last assigned on line 370 could be null and is dereferenced at line 380, column 5. libavcodec/utils.c:363:1: start of procedure avcodec_default_release_buffer() 361. } 362. 363. void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){ ^ 364. int i; 365. InternalBuffer *buf, *last; libavcodec/utils.c:367:5: 365. InternalBuffer *buf, *last; 366. 367. assert(pic->type==FF_BUFFER_TYPE_INTERNAL); ^ 368. assert(s->internal_buffer_count); 369. libavcodec/utils.c:368:5: 366. 367. assert(pic->type==FF_BUFFER_TYPE_INTERNAL); 368. assert(s->internal_buffer_count); ^ 369. 370. buf = NULL; /* avoids warning */ libavcodec/utils.c:370:5: 368. assert(s->internal_buffer_count); 369. 370. buf = NULL; /* avoids warning */ ^ 371. for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize 372. buf= &((InternalBuffer*)s->internal_buffer)[i]; libavcodec/utils.c:371:9: 369. 370. buf = NULL; /* avoids warning */ 371. for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize ^ 372. buf= &((InternalBuffer*)s->internal_buffer)[i]; 373. if(buf->data[0] == pic->data[0]) libavcodec/utils.c:371:14: Loop condition is false. Leaving loop 369. 370. buf = NULL; /* avoids warning */ 371. for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize ^ 372. buf= &((InternalBuffer*)s->internal_buffer)[i]; 373. if(buf->data[0] == pic->data[0]) libavcodec/utils.c:376:5: 374. break; 375. } 376. assert(i < s->internal_buffer_count); ^ 377. s->internal_buffer_count--; 378. last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; libavcodec/utils.c:377:5: 375. } 376. assert(i < s->internal_buffer_count); 377. s->internal_buffer_count--; ^ 378. last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; 379. libavcodec/utils.c:378:5: 376. assert(i < s->internal_buffer_count); 377. s->internal_buffer_count--; 378. last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; ^ 379. 380. FFSWAP(InternalBuffer, *buf, *last); libavcodec/utils.c:380:5: 378. last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; 379. 380. FFSWAP(InternalBuffer, *buf, *last); ^ 381. 382. for(i=0; i<4; i++){
https://github.com/libav/libav/blob/f4c79d1e0b2e797012304db57903e4091b0c2d7c/libavcodec/utils.c/#L380
d2a_code_trace_data_44997
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/mpc8.c:325: error: Integer Overflow L2 ([1, +oo] - 7):unsigned32 by call to `bitstream_read`. libavcodec/mpc8.c:325:43: Call 323. 324. if(c->oldDSCF[ch][i]){ 325. bands[i].scf_idx[ch][0] = bitstream_read(bc, 7) - 6; ^ 326. c->oldDSCF[ch][i] = 0; 327. }else{ 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:194:12: Call 192. } 193. 194. return get_val(bc, n); ^ 195. } 196. 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] - 7):unsigned32 by call to `bitstream_read` 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_44998
void ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size) { size_t used, free; used = (size_t) (ctx->bytes & 0x3f); ctx->bytes += size; if (used) { free = 64 - used; if (size < free) { ngx_memcpy(&ctx->buffer[used], data, size); return; } ngx_memcpy(&ctx->buffer[used], data, free); data = (u_char *) data + free; size -= free; (void) ngx_md5_body(ctx, ctx->buffer, 64); } if (size >= 64) { data = ngx_md5_body(ctx, data, size & ~(size_t) 0x3f); size &= 0x3f; } ngx_memcpy(ctx->buffer, data, size); } src/http/ngx_http_file_cache.c:592: error: Integer Overflow L2 ([1, 128] - [1, 63]):unsigned64 by call to `ngx_http_file_cache_vary`. src/http/ngx_http_file_cache.c:592:9: Call 590. 591. if (h->vary_len) { 592. ngx_http_file_cache_vary(r, h->vary, h->vary_len, c->variant); ^ 593. 594. if (ngx_memcmp(c->variant, h->variant, NGX_HTTP_CACHE_KEY_LEN) != 0) { src/http/ngx_http_file_cache.c:1054:1: Array declaration 1052. 1053. 1054. static void ^ 1055. ngx_http_file_cache_vary(ngx_http_request_t *r, u_char *vary, size_t len, 1056. u_char *hash) src/http/ngx_http_file_cache.c:1071:5: Assignment 1069. ngx_strlow(buf, vary, len); 1070. 1071. p = buf; ^ 1072. last = buf + len; 1073. src/http/ngx_http_file_cache.c:1082:9: Assignment 1080. while (p < last && *p != ',' && *p != ' ') { p++; } 1081. 1082. name.len = p - name.data; ^ 1083. 1084. if (name.len == 0) { src/http/ngx_http_file_cache.c:1091:9: Call 1089. "http file cache vary: %V", &name); 1090. 1091. ngx_md5_update(&md5, name.data, name.len); ^ 1092. ngx_md5_update(&md5, (u_char *) ":", sizeof(":") - 1); 1093. src/core/ngx_md5.c:30:1: <LHS trace> 28. 29. 30. void ^ 31. ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size) 32. { src/core/ngx_md5.c:30:1: Parameter `size` 28. 29. 30. void ^ 31. ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size) 32. { src/core/ngx_md5.c:30:1: <RHS trace> 28. 29. 30. void ^ 31. ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size) 32. { src/core/ngx_md5.c:30:1: Parameter `size` 28. 29. 30. void ^ 31. ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size) 32. { src/core/ngx_md5.c:48:9: Binary operation: ([1, 128] - [1, 63]):unsigned64 by call to `ngx_http_file_cache_vary` 46. ngx_memcpy(&ctx->buffer[used], data, free); 47. data = (u_char *) data + free; 48. size -= free; ^ 49. (void) ngx_md5_body(ctx, ctx->buffer, 64); 50. }
https://github.com/nginx/nginx/blob/5544756296e5abaecb5f640753d6de939b701035/src/core/ngx_md5.c/#L48
d2a_code_trace_data_44999
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/ssltest.c:519: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_new`. Showing all 18 steps of the trace ssl/ssltest.c:518:8: Call 516. } 517. 518. c_ssl=SSL_new(c_ctx); ^ 519. s_ssl=SSL_new(s_ctx); 520. ssl/ssl_lib.c:175:1: Parameter `ctx->sessions->p` 173. } 174. 175. > SSL *SSL_new(SSL_CTX *ctx) 176. { 177. SSL *s; ssl/ssltest.c:519:8: Call 517. 518. c_ssl=SSL_new(c_ctx); 519. s_ssl=SSL_new(s_ctx); ^ 520. 521. #ifndef NO_KRB5 ssl/ssl_lib.c:175:1: Parameter `ctx->sessions->p` 173. } 174. 175. > SSL *SSL_new(SSL_CTX *ctx) 176. { 177. SSL *s; ssl/ssl_lib.c:239:2: Call 237. s->mode=ctx->mode; 238. s->read_ahead=ctx->read_ahead; /* used to happen in SSL_clear */ 239. SSL_clear(s); ^ 240. 241. CRYPTO_new_ex_data(ssl_meth,s,&s->ex_data); ssl/ssl_lib.c:86:1: Parameter `s->ctx->sessions->p` 84. }; 85. 86. > int SSL_clear(SSL *s) 87. { 88. int state; ssl/ssl_lib.c:134:6: Call 132. ssl_clear_cipher_ctx(s); 133. 134. if (ssl_clear_bad_session(s)) ^ 135. { 136. SSL_SESSION_free(s->session); ssl/ssl_sess.c:614:1: Parameter `s->ctx->sessions->p` 612. } 613. 614. > int ssl_clear_bad_session(SSL *s) 615. { 616. if ( (s->session != NULL) && ssl/ssl_sess.c:620:3: Call 618. !(SSL_in_init(s) || SSL_in_before(s))) 619. { 620. SSL_CTX_remove_session(s->ctx,s->session); ^ 621. return(1); 622. } ssl/ssl_sess.c:413:1: Parameter `ctx->sessions->p` 411. } 412. 413. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 414. { 415. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:415:9: Call 413. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 414. { 415. return remove_session_lock(ctx, c, 1); ^ 416. } 417. ssl/ssl_sess.c:418:1: Parameter `ctx->sessions->p` 416. } 417. 418. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 419. { 420. SSL_SESSION *r; ssl/ssl_sess.c:426:20: Call 424. { 425. if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX); 426. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 427. if (r != NULL) 428. { crypto/lhash/lhash.c:217:1: Parameter `lh->pmax` 215. } 216. 217. > void *lh_delete(LHASH *lh, 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(ret); crypto/lhash/lhash.c:352:1: <LHS trace> 350. } 351. 352. > static void contract(LHASH *lh) 353. { 354. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:352:1: Parameter `lh->p` 350. } 351. 352. > static void contract(LHASH *lh) 353. { 354. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:356:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_new` 354. LHASH_NODE **n,*n1,*np; 355. 356. np=lh->b[lh->p+lh->pmax-1]; ^ 357. lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */ 358. if (lh->p == 0)
https://github.com/openssl/openssl/blob/f9b3bff6f7e38960bb87a5623fbcbc45ee952c49/crypto/lhash/lhash.c/#L356
d2a_code_trace_data_45000
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->staticbuf == NULL && (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; } if (allocbytes != NULL) *allocbytes = WPACKET_get_curr(pkt); return 1; } ssl/statem/extensions_srvr.c:775: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 6]):unsigned64 by call to `tls_construct_cert_status_body`. Showing all 14 steps of the trace ssl/statem/extensions_srvr.c:765:17: Call 763. 764. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_status_request) 765. || !WPACKET_start_sub_packet_u16(pkt)) { ^ 766. SSLerr(SSL_F_TLS_CONSTRUCT_STOC_STATUS_REQUEST, ERR_R_INTERNAL_ERROR); 767. return 0; ssl/packet.c:252:1: Parameter `pkt->buf->length` 250. } 251. 252. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 253. { 254. WPACKET_SUB *sub; ssl/statem/extensions_srvr.c:775:30: Call 773. * separate message 774. */ 775. if ((SSL_IS_TLS13(s) && !tls_construct_cert_status_body(s, pkt)) ^ 776. || !WPACKET_close(pkt)) { 777. SSLerr(SSL_F_TLS_CONSTRUCT_STOC_STATUS_REQUEST, ERR_R_INTERNAL_ERROR); ssl/statem/statem_srvr.c:3466:1: Parameter `pkt->written` 3464. * create a separate message. Returns 1 on success or 0 on failure. 3465. */ 3466. > int tls_construct_cert_status_body(SSL *s, WPACKET *pkt) 3467. { 3468. if (!WPACKET_put_bytes_u8(pkt, s->ext.status_type) ssl/statem/statem_srvr.c:3468:10: Call 3466. int tls_construct_cert_status_body(SSL *s, WPACKET *pkt) 3467. { 3468. if (!WPACKET_put_bytes_u8(pkt, s->ext.status_type) ^ 3469. || !WPACKET_sub_memcpy_u24(pkt, s->ext.ocsp.resp, 3470. s->ext.ocsp.resp_len)) { ssl/packet.c:289:1: Parameter `pkt->written` 287. } 288. 289. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 290. { 291. unsigned char *data; ssl/packet.c:297:17: Call 295. 296. if (size > sizeof(unsigned int) 297. || !WPACKET_allocate_bytes(pkt, size, &data) ^ 298. || !put_value(data, val, size)) 299. return 0; 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:39:1: <LHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `pkt->buf->length` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: <RHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `len` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:49:36: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 6]):unsigned64 by call to `tls_construct_cert_status_body` 47. return 0; 48. 49. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { ^ 50. size_t newlen; 51. size_t reflen;
https://github.com/openssl/openssl/blob/f61c5ca6ca183bf0a51651857e3efb02a98889ad/ssl/packet.c/#L49
d2a_code_trace_data_45001
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_eay.c:776: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked`. Showing all 29 steps of the trace crypto/rsa/rsa_eay.c:737:1: Parameter `ctx->stack.depth` 735. } 736. 737. > static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) 738. { 739. BIGNUM *r1,*m1,*vrfy; crypto/rsa/rsa_eay.c:744:2: Call 742. int ret=0; 743. 744. BN_CTX_start(ctx); ^ 745. r1 = BN_CTX_get(ctx); 746. m1 = 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_eay.c:774:9: Call 772. if (rsa->flags & RSA_FLAG_CACHE_PRIVATE) 773. { 774. if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_p, CRYPTO_LOCK_RSA, p, ctx)) ^ 775. goto err; 776. if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_q, CRYPTO_LOCK_RSA, q, ctx)) crypto/bn/bn_mont.c:478:1: Parameter `ctx->stack.depth` 476. } 477. 478. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, 479. const BIGNUM *mod, BN_CTX *ctx) 480. { crypto/rsa/rsa_eay.c:776:9: Call 774. if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_p, CRYPTO_LOCK_RSA, p, ctx)) 775. goto err; 776. if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_q, CRYPTO_LOCK_RSA, q, ctx)) ^ 777. goto err; 778. } crypto/bn/bn_mont.c:478:1: Parameter `ctx->stack.depth` 476. } 477. 478. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, 479. const BIGNUM *mod, BN_CTX *ctx) 480. { crypto/bn/bn_mont.c:494:16: Call 492. { 493. ret = BN_MONT_CTX_new(); 494. if (ret && !BN_MONT_CTX_set(ret, mod, ctx)) ^ 495. BN_MONT_CTX_free(ret); 496. else crypto/bn/bn_mont.c:355:1: Parameter `ctx->stack.depth` 353. } 354. 355. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 356. { 357. int ret = 0; crypto/bn/bn_mont.c:360:2: Call 358. BIGNUM *Ri,*R; 359. 360. BN_CTX_start(ctx); ^ 361. if((Ri = BN_CTX_get(ctx)) == NULL) goto err; 362. R= &(mont->RR); /* grab RR as a temp */ 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_mont.c:421:8: Call 419. tmod.top = buf[0] != 0 ? 1 : 0; 420. /* Ri = R^-1 mod N*/ 421. if ((BN_mod_inverse(Ri,R,&tmod,ctx)) == NULL) ^ 422. goto err; 423. if (!BN_lshift(Ri,Ri,BN_BITS2)) goto err; /* R*Ri */ 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, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked` 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_45002
int dtls1_buffer_message(SSL *s, int is_ccs) { pitem *item; hm_fragment *frag; unsigned char seq64be[8]; OPENSSL_assert(s->init_off == 0); frag = dtls1_hm_fragment_new(s->init_num); memcpy(frag->fragment, s->init_buf->data, s->init_num); if ( is_ccs) { OPENSSL_assert(s->d1->w_msg_hdr.msg_len + DTLS1_CCS_HEADER_LENGTH == (unsigned int)s->init_num); } else { OPENSSL_assert(s->d1->w_msg_hdr.msg_len + DTLS1_HM_HEADER_LENGTH == (unsigned int)s->init_num); } frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len; frag->msg_header.seq = s->d1->w_msg_hdr.seq; frag->msg_header.type = s->d1->w_msg_hdr.type; frag->msg_header.frag_off = 0; frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; frag->msg_header.is_ccs = is_ccs; memset(seq64be,0,sizeof(seq64be)); seq64be[6] = (unsigned char)(frag->msg_header.seq>>8); seq64be[7] = (unsigned char)(frag->msg_header.seq); item = pitem_new(seq64be, frag); if ( item == NULL) { dtls1_hm_fragment_free(frag); return 0; } #if 0 fprintf( stderr, "buffered messge: \ttype = %xx\n", msg_buf->type); fprintf( stderr, "\t\t\t\t\tlen = %d\n", msg_buf->len); fprintf( stderr, "\t\t\t\t\tseq_num = %d\n", msg_buf->seq_num); #endif pqueue_insert(s->d1->sent_messages, item); return 1; } ssl/d1_both.c:1050: error: NULL_DEREFERENCE pointer `frag` last assigned on line 1048 could be null and is dereferenced at line 1050, column 9. Showing all 21 steps of the trace ssl/d1_both.c:1037:1: start of procedure dtls1_buffer_message() 1035. #endif 1036. 1037. > int 1038. dtls1_buffer_message(SSL *s, int is_ccs) 1039. { ssl/d1_both.c:1046:2: Condition is true 1044. /* this function is called immediately after a message has 1045. * been serialized */ 1046. OPENSSL_assert(s->init_off == 0); ^ 1047. 1048. frag = dtls1_hm_fragment_new(s->init_num); ssl/d1_both.c:1048:2: 1046. OPENSSL_assert(s->init_off == 0); 1047. 1048. > frag = dtls1_hm_fragment_new(s->init_num); 1049. 1050. memcpy(frag->fragment, s->init_buf->data, s->init_num); ssl/d1_both.c:144:1: start of procedure dtls1_hm_fragment_new() 142. static void dtls1_process_handshake_fragment(SSL *s, int frag_len); 143. 144. > static hm_fragment * 145. dtls1_hm_fragment_new(unsigned long frag_len) 146. { ssl/d1_both.c:147:2: 145. dtls1_hm_fragment_new(unsigned long frag_len) 146. { 147. > hm_fragment *frag = NULL; 148. unsigned char *buf = NULL; 149. ssl/d1_both.c:148:2: 146. { 147. hm_fragment *frag = NULL; 148. > unsigned char *buf = NULL; 149. 150. frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment)); ssl/d1_both.c:150:2: 148. unsigned char *buf = NULL; 149. 150. > frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment)); 151. if ( frag == NULL) 152. return NULL; 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 false branch 299. 300. allow_customize = 0; 301. if (malloc_debug_func != NULL) ^ 302. { 303. allow_customize_debug = 0; 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 false 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: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. crypto/mem.c:324:2: return from a call to CRYPTO_malloc 322. 323. return ret; 324. } ^ 325. 326. void *CRYPTO_realloc(void *str, int num, const char *file, int line) ssl/d1_both.c:151:7: Taking true branch 149. 150. frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment)); 151. if ( frag == NULL) ^ 152. return NULL; 153. ssl/d1_both.c:152:3: 150. frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment)); 151. if ( frag == NULL) 152. > return NULL; 153. 154. buf = (unsigned char *)OPENSSL_malloc(frag_len ssl/d1_both.c:165:2: return from a call to dtls1_hm_fragment_new 163. 164. return frag; 165. } ^ 166. 167. static void ssl/d1_both.c:1050:2: 1048. frag = dtls1_hm_fragment_new(s->init_num); 1049. 1050. > memcpy(frag->fragment, s->init_buf->data, s->init_num); 1051. 1052. if ( is_ccs)
https://github.com/openssl/openssl/blob/89c333e3e5af6eb0f1d8986710448ac85116235a/ssl/d1_both.c/#L1050
d2a_code_trace_data_45003
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:889: error: Uninitialized Value The value read from ymin was never initialized. libavcodec/motion_est_template.c:889:9: 887. //ensure that the refernece samples for hpel refinement are in the map 888. CHECK_MV(best[0]-1, best[1]) 889. CHECK_MV(best[0]+1, best[1]) ^ 890. CHECK_MV(best[0], best[1]-1) 891. CHECK_MV(best[0], best[1]+1)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L889
d2a_code_trace_data_45004
static int inter_recon(AVCodecContext *avctx) { static const uint8_t bwlog_tab[2][N_BS_SIZES] = { { 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 }, { 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4 }, }; VP9Context *s = avctx->priv_data; VP9Block *const b = &s->b; int row = b->row, col = b->col; AVFrame *ref1 = s->refs[s->refidx[b->ref[0]]]; AVFrame *ref2 = b->comp ? s->refs[s->refidx[b->ref[1]]] : NULL; int w = avctx->width, h = avctx->height; ptrdiff_t ls_y = b->y_stride, ls_uv = b->uv_stride; if (!ref1->data[0] || (b->comp && !ref2->data[0])) return AVERROR_INVALIDDATA; if (b->bs > BS_8x8) { if (b->bs == BS_8x4) { mc_luma_dir(s, s->dsp.mc[3][b->filter][0], b->dst[0], ls_y, ref1->data[0], ref1->linesize[0], row << 3, col << 3, &b->mv[0][0], 8, 4, w, h); mc_luma_dir(s, s->dsp.mc[3][b->filter][0], b->dst[0] + 4 * ls_y, ls_y, ref1->data[0], ref1->linesize[0], (row << 3) + 4, col << 3, &b->mv[2][0], 8, 4, w, h); if (b->comp) { mc_luma_dir(s, s->dsp.mc[3][b->filter][1], b->dst[0], ls_y, ref2->data[0], ref2->linesize[0], row << 3, col << 3, &b->mv[0][1], 8, 4, w, h); mc_luma_dir(s, s->dsp.mc[3][b->filter][1], b->dst[0] + 4 * ls_y, ls_y, ref2->data[0], ref2->linesize[0], (row << 3) + 4, col << 3, &b->mv[2][1], 8, 4, w, h); } } else if (b->bs == BS_4x8) { mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0], ls_y, ref1->data[0], ref1->linesize[0], row << 3, col << 3, &b->mv[0][0], 4, 8, w, h); mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0] + 4, ls_y, ref1->data[0], ref1->linesize[0], row << 3, (col << 3) + 4, &b->mv[1][0], 4, 8, w, h); if (b->comp) { mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0], ls_y, ref2->data[0], ref2->linesize[0], row << 3, col << 3, &b->mv[0][1], 4, 8, w, h); mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0] + 4, ls_y, ref2->data[0], ref2->linesize[0], row << 3, (col << 3) + 4, &b->mv[1][1], 4, 8, w, h); } } else { av_assert2(b->bs == BS_4x4); mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0], ls_y, ref1->data[0], ref1->linesize[0], row << 3, col << 3, &b->mv[0][0], 4, 4, w, h); mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0] + 4, ls_y, ref1->data[0], ref1->linesize[0], row << 3, (col << 3) + 4, &b->mv[1][0], 4, 4, w, h); mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0] + 4 * ls_y, ls_y, ref1->data[0], ref1->linesize[0], (row << 3) + 4, col << 3, &b->mv[2][0], 4, 4, w, h); mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0] + 4 * ls_y + 4, ls_y, ref1->data[0], ref1->linesize[0], (row << 3) + 4, (col << 3) + 4, &b->mv[3][0], 4, 4, w, h); if (b->comp) { mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0], ls_y, ref2->data[0], ref2->linesize[0], row << 3, col << 3, &b->mv[0][1], 4, 4, w, h); mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0] + 4, ls_y, ref2->data[0], ref2->linesize[0], row << 3, (col << 3) + 4, &b->mv[1][1], 4, 4, w, h); mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0] + 4 * ls_y, ls_y, ref2->data[0], ref2->linesize[0], (row << 3) + 4, col << 3, &b->mv[2][1], 4, 4, w, h); mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0] + 4 * ls_y + 4, ls_y, ref2->data[0], ref2->linesize[0], (row << 3) + 4, (col << 3) + 4, &b->mv[3][1], 4, 4, w, h); } } } else { int bwl = bwlog_tab[0][b->bs]; int bw = bwh_tab[0][b->bs][0] * 4; int bh = bwh_tab[0][b->bs][1] * 4; mc_luma_dir(s, s->dsp.mc[bwl][b->filter][0], b->dst[0], ls_y, ref1->data[0], ref1->linesize[0], row << 3, col << 3, &b->mv[0][0], bw, bh, w, h); if (b->comp) mc_luma_dir(s, s->dsp.mc[bwl][b->filter][1], b->dst[0], ls_y, ref2->data[0], ref2->linesize[0], row << 3, col << 3, &b->mv[0][1], bw, bh, w, h); } { int bwl = bwlog_tab[1][b->bs]; int bw = bwh_tab[1][b->bs][0] * 4, bh = bwh_tab[1][b->bs][1] * 4; VP56mv mvuv; w = (w + 1) >> 1; h = (h + 1) >> 1; if (b->bs > BS_8x8) { mvuv.x = ROUNDED_DIV(b->mv[0][0].x + b->mv[1][0].x + b->mv[2][0].x + b->mv[3][0].x, 4); mvuv.y = ROUNDED_DIV(b->mv[0][0].y + b->mv[1][0].y + b->mv[2][0].y + b->mv[3][0].y, 4); } else { mvuv = b->mv[0][0]; } mc_chroma_dir(s, s->dsp.mc[bwl][b->filter][0], b->dst[1], b->dst[2], ls_uv, ref1->data[1], ref1->linesize[1], ref1->data[2], ref1->linesize[2], row << 2, col << 2, &mvuv, bw, bh, w, h); if (b->comp) { if (b->bs > BS_8x8) { mvuv.x = ROUNDED_DIV(b->mv[0][1].x + b->mv[1][1].x + b->mv[2][1].x + b->mv[3][1].x, 4); mvuv.y = ROUNDED_DIV(b->mv[0][1].y + b->mv[1][1].y + b->mv[2][1].y + b->mv[3][1].y, 4); } else { mvuv = b->mv[0][1]; } mc_chroma_dir(s, s->dsp.mc[bwl][b->filter][1], b->dst[1], b->dst[2], ls_uv, ref2->data[1], ref2->linesize[1], ref2->data[2], ref2->linesize[2], row << 2, col << 2, &mvuv, bw, bh, w, h); } } if (!b->skip) { int w4 = bwh_tab[1][b->bs][0] << 1, step1d = 1 << b->tx, n; int h4 = bwh_tab[1][b->bs][1] << 1, x, y, step = 1 << (b->tx * 2); int end_x = FFMIN(2 * (s->cols - col), w4); int end_y = FFMIN(2 * (s->rows - row), h4); int tx = 4 * s->lossless + b->tx, uvtx = b->uvtx + 4 * s->lossless; int uvstep1d = 1 << b->uvtx, p; uint8_t *dst = b->dst[0]; for (n = 0, y = 0; y < end_y; y += step1d) { uint8_t *ptr = dst; for (x = 0; x < end_x; x += step1d, ptr += 4 * step1d, n += step) { int eob = b->tx > TX_8X8 ? AV_RN16A(&s->eob[n]) : s->eob[n]; if (eob) s->dsp.itxfm_add[tx][DCT_DCT](ptr, b->y_stride, s->block + 16 * n, eob); } dst += 4 * b->y_stride * step1d; } h4 >>= 1; w4 >>= 1; end_x >>= 1; end_y >>= 1; step = 1 << (b->uvtx * 2); for (p = 0; p < 2; p++) { dst = b->dst[p + 1]; for (n = 0, y = 0; y < end_y; y += uvstep1d) { uint8_t *ptr = dst; for (x = 0; x < end_x; x += uvstep1d, ptr += 4 * uvstep1d, n += step) { int eob = b->uvtx > TX_8X8 ? AV_RN16A(&s->uveob[p][n]) : s->uveob[p][n]; if (eob) s->dsp.itxfm_add[uvtx][DCT_DCT](ptr, b->uv_stride, s->uvblock[p] + 16 * n, eob); } dst += 4 * uvstep1d * b->uv_stride; } } } return 0; } libavcodec/vp9block.c:1266: error: Null Dereference pointer `ref2` last assigned on line 1229 could be null and is dereferenced at line 1266, column 29. libavcodec/vp9block.c:1219:1: start of procedure inter_recon() 1217. } 1218. 1219. static int inter_recon(AVCodecContext *avctx) ^ 1220. { 1221. static const uint8_t bwlog_tab[2][N_BS_SIZES] = { libavcodec/vp9block.c:1221:5: 1219. static int inter_recon(AVCodecContext *avctx) 1220. { 1221. static const uint8_t bwlog_tab[2][N_BS_SIZES] = { ^ 1222. { 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 }, 1223. { 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4 }, libavcodec/vp9block.c:1225:5: 1223. { 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4 }, 1224. }; 1225. VP9Context *s = avctx->priv_data; ^ 1226. VP9Block *const b = &s->b; 1227. int row = b->row, col = b->col; libavcodec/vp9block.c:1226:5: 1224. }; 1225. VP9Context *s = avctx->priv_data; 1226. VP9Block *const b = &s->b; ^ 1227. int row = b->row, col = b->col; 1228. AVFrame *ref1 = s->refs[s->refidx[b->ref[0]]]; libavcodec/vp9block.c:1227:5: 1225. VP9Context *s = avctx->priv_data; 1226. VP9Block *const b = &s->b; 1227. int row = b->row, col = b->col; ^ 1228. AVFrame *ref1 = s->refs[s->refidx[b->ref[0]]]; 1229. AVFrame *ref2 = b->comp ? s->refs[s->refidx[b->ref[1]]] : NULL; libavcodec/vp9block.c:1228:5: 1226. VP9Block *const b = &s->b; 1227. int row = b->row, col = b->col; 1228. AVFrame *ref1 = s->refs[s->refidx[b->ref[0]]]; ^ 1229. AVFrame *ref2 = b->comp ? s->refs[s->refidx[b->ref[1]]] : NULL; 1230. int w = avctx->width, h = avctx->height; libavcodec/vp9block.c:1229:21: Condition is false 1227. int row = b->row, col = b->col; 1228. AVFrame *ref1 = s->refs[s->refidx[b->ref[0]]]; 1229. AVFrame *ref2 = b->comp ? s->refs[s->refidx[b->ref[1]]] : NULL; ^ 1230. int w = avctx->width, h = avctx->height; 1231. ptrdiff_t ls_y = b->y_stride, ls_uv = b->uv_stride; libavcodec/vp9block.c:1229:5: 1227. int row = b->row, col = b->col; 1228. AVFrame *ref1 = s->refs[s->refidx[b->ref[0]]]; 1229. AVFrame *ref2 = b->comp ? s->refs[s->refidx[b->ref[1]]] : NULL; ^ 1230. int w = avctx->width, h = avctx->height; 1231. ptrdiff_t ls_y = b->y_stride, ls_uv = b->uv_stride; libavcodec/vp9block.c:1230:5: 1228. AVFrame *ref1 = s->refs[s->refidx[b->ref[0]]]; 1229. AVFrame *ref2 = b->comp ? s->refs[s->refidx[b->ref[1]]] : NULL; 1230. int w = avctx->width, h = avctx->height; ^ 1231. ptrdiff_t ls_y = b->y_stride, ls_uv = b->uv_stride; 1232. libavcodec/vp9block.c:1231:5: 1229. AVFrame *ref2 = b->comp ? s->refs[s->refidx[b->ref[1]]] : NULL; 1230. int w = avctx->width, h = avctx->height; 1231. ptrdiff_t ls_y = b->y_stride, ls_uv = b->uv_stride; ^ 1232. 1233. if (!ref1->data[0] || (b->comp && !ref2->data[0])) libavcodec/vp9block.c:1233:10: Taking false branch 1231. ptrdiff_t ls_y = b->y_stride, ls_uv = b->uv_stride; 1232. 1233. if (!ref1->data[0] || (b->comp && !ref2->data[0])) ^ 1234. return AVERROR_INVALIDDATA; 1235. libavcodec/vp9block.c:1233:28: Taking false branch 1231. ptrdiff_t ls_y = b->y_stride, ls_uv = b->uv_stride; 1232. 1233. if (!ref1->data[0] || (b->comp && !ref2->data[0])) ^ 1234. return AVERROR_INVALIDDATA; 1235. libavcodec/vp9block.c:1237:9: Taking true branch 1235. 1236. // y inter pred 1237. if (b->bs > BS_8x8) { ^ 1238. if (b->bs == BS_8x4) { 1239. mc_luma_dir(s, s->dsp.mc[3][b->filter][0], b->dst[0], ls_y, libavcodec/vp9block.c:1238:13: Taking false branch 1236. // y inter pred 1237. if (b->bs > BS_8x8) { 1238. if (b->bs == BS_8x4) { ^ 1239. mc_luma_dir(s, s->dsp.mc[3][b->filter][0], b->dst[0], ls_y, 1240. ref1->data[0], ref1->linesize[0], libavcodec/vp9block.c:1256:20: Taking true branch 1254. (row << 3) + 4, col << 3, &b->mv[2][1], 8, 4, w, h); 1255. } 1256. } else if (b->bs == BS_4x8) { ^ 1257. mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0], ls_y, 1258. ref1->data[0], ref1->linesize[0], libavcodec/vp9block.c:1257:13: Skipping mc_luma_dir(): empty list of specs 1255. } 1256. } else if (b->bs == BS_4x8) { 1257. mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0], ls_y, ^ 1258. ref1->data[0], ref1->linesize[0], 1259. row << 3, col << 3, &b->mv[0][0], 4, 8, w, h); libavcodec/vp9block.c:1260:13: Skipping mc_luma_dir(): empty list of specs 1258. ref1->data[0], ref1->linesize[0], 1259. row << 3, col << 3, &b->mv[0][0], 4, 8, w, h); 1260. mc_luma_dir(s, s->dsp.mc[4][b->filter][0], b->dst[0] + 4, ls_y, ^ 1261. ref1->data[0], ref1->linesize[0], 1262. row << 3, (col << 3) + 4, &b->mv[1][0], 4, 8, w, h); libavcodec/vp9block.c:1264:17: Taking true branch 1262. row << 3, (col << 3) + 4, &b->mv[1][0], 4, 8, w, h); 1263. 1264. if (b->comp) { ^ 1265. mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0], ls_y, 1266. ref2->data[0], ref2->linesize[0], libavcodec/vp9block.c:1265:17: 1263. 1264. if (b->comp) { 1265. mc_luma_dir(s, s->dsp.mc[4][b->filter][1], b->dst[0], ls_y, ^ 1266. ref2->data[0], ref2->linesize[0], 1267. row << 3, col << 3, &b->mv[0][1], 4, 8, w, h);
https://github.com/libav/libav/blob/55b59fab880a9fcdd30f97c5170af282087ac4f7/libavcodec/vp9block.c/#L1266
d2a_code_trace_data_45005
static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) { BIGNUM *n; BN_ULONG *ap, *np, *rp, n0, v, carry; int nl, max, i; n = &(mont->N); nl = n->top; if (nl == 0) { ret->top = 0; return (1); } max = (2 * nl); if (bn_wexpand(r, max) == NULL) return (0); r->neg ^= n->neg; np = n->d; rp = r->d; i = max - r->top; if (i) memset(&rp[r->top], 0, sizeof(*rp) * i); r->top = max; n0 = mont->n0[0]; for (carry = 0, i = 0; i < nl; i++, rp++) { v = bn_mul_add_words(rp, np, nl, (rp[0] * n0) & BN_MASK2); v = (v + carry + rp[nl]) & BN_MASK2; carry |= (v != rp[nl]); carry &= (v <= rp[nl]); rp[nl] = v; } if (bn_wexpand(ret, nl) == NULL) return (0); ret->top = nl; ret->neg = r->neg; rp = ret->d; ap = &(r->d[nl]); # define BRANCH_FREE 1 # if BRANCH_FREE { BN_ULONG *nrp; size_t m; v = bn_sub_words(rp, ap, np, nl) - carry; m = (0 - (size_t)v); nrp = (BN_ULONG *)(((PTR_SIZE_INT) rp & ~m) | ((PTR_SIZE_INT) ap & m)); for (i = 0, nl -= 4; i < nl; i += 4) { BN_ULONG t1, t2, t3, t4; t1 = nrp[i + 0]; t2 = nrp[i + 1]; t3 = nrp[i + 2]; ap[i + 0] = 0; t4 = nrp[i + 3]; ap[i + 1] = 0; rp[i + 0] = t1; ap[i + 2] = 0; rp[i + 1] = t2; ap[i + 3] = 0; rp[i + 2] = t3; rp[i + 3] = t4; } for (nl += 4; i < nl; i++) rp[i] = nrp[i], ap[i] = 0; } # else if (bn_sub_words(rp, ap, np, nl) - carry) memcpy(rp, ap, nl * sizeof(BN_ULONG)); # endif bn_correct_top(r); bn_correct_top(ret); bn_check_top(ret); return (1); } test/bntest.c:1169: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] (⇐ [0, +oo] + [1, +oo]) Size: [0, 8388607] by call to `BN_from_montgomery`. Showing all 13 steps of the trace test/bntest.c:1168:5: Call 1166. */ 1167. BN_one(a); 1168. BN_MONT_CTX_set(mont, m, ctx); ^ 1169. if (!BN_from_montgomery(e, a, mont, ctx)) 1170. return 0; crypto/bn/bn_mont.c:247:1: Parameter `mont->N.top` 245. } 246. 247. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 248. { 249. int ret = 0; test/bntest.c:1169:10: Call 1167. BN_one(a); 1168. BN_MONT_CTX_set(mont, m, ctx); 1169. if (!BN_from_montgomery(e, a, mont, ctx)) ^ 1170. return 0; 1171. if (!BN_mod_exp_mont_consttime(d, e, p, m, ctx, NULL)) crypto/bn/bn_mont.c:166:1: Parameter `mont->N.top` 164. #endif /* MONT_WORD */ 165. 166. > int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont, 167. BN_CTX *ctx) 168. { crypto/bn/bn_mont.c:175:16: Call 173. BN_CTX_start(ctx); 174. if ((t = BN_CTX_get(ctx)) && BN_copy(t, a)) 175. retn = BN_from_montgomery_word(ret, t, mont); ^ 176. BN_CTX_end(ctx); 177. #else /* !MONT_WORD */ crypto/bn/bn_mont.c:104:21: <Offset trace> 102. n0 = mont->n0[0]; 103. 104. for (carry = 0, i = 0; i < nl; i++, rp++) { ^ 105. v = bn_mul_add_words(rp, np, nl, (rp[0] * n0) & BN_MASK2); 106. v = (v + carry + rp[nl]) & BN_MASK2; crypto/bn/bn_mont.c:104:21: Assignment 102. n0 = mont->n0[0]; 103. 104. for (carry = 0, i = 0; i < nl; i++, rp++) { ^ 105. v = bn_mul_add_words(rp, np, nl, (rp[0] * n0) & BN_MASK2); 106. v = (v + carry + rp[nl]) & BN_MASK2; crypto/bn/bn_mont.c:75:1: <Length trace> 73. 74. #ifdef MONT_WORD 75. > static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) 76. { 77. BIGNUM *n; crypto/bn/bn_mont.c:75:1: Parameter `*r->d` 73. 74. #ifdef MONT_WORD 75. > static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) 76. { 77. BIGNUM *n; crypto/bn/bn_mont.c:89:9: Call 87. 88. max = (2 * nl); /* carry is stored separately */ 89. if (bn_wexpand(r, max) == NULL) ^ 90. return (0); 91. 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_mont.c:94:5: Assignment 92. r->neg ^= n->neg; 93. np = n->d; 94. rp = r->d; ^ 95. 96. /* clear the top words of T */ crypto/bn/bn_mont.c:106:26: Array access: Offset: [1, +oo] (⇐ [0, +oo] + [1, +oo]) Size: [0, 8388607] by call to `BN_from_montgomery` 104. for (carry = 0, i = 0; i < nl; i++, rp++) { 105. v = bn_mul_add_words(rp, np, nl, (rp[0] * n0) & BN_MASK2); 106. v = (v + carry + rp[nl]) & BN_MASK2; ^ 107. carry |= (v != rp[nl]); 108. carry &= (v <= rp[nl]);
https://github.com/openssl/openssl/blob/b3618f44a7b8504bfb0a64e8a33e6b8e56d4d516/crypto/bn/bn_mont.c/#L106
d2a_code_trace_data_45006
int test_gf2m_mod_inv(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b[2], *c, *d; 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(); 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); for (j = 0; j < 2; j++) { BN_GF2m_mod_inv(c, a, b[j], ctx); BN_GF2m_mod_mul(d, a, c, b[j], ctx); if (!BN_is_one(d)) { fprintf(stderr, "GF(2^m) modular inversion 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); return ret; } test/bntest.c:1423: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1400, column 9 is not reachable after line 1423, column 5. Showing all 133 steps of the trace test/bntest.c:1393:1: start of procedure test_gf2m_mod_inv() 1391. } 1392. 1393. > int test_gf2m_mod_inv(BIO *bp, BN_CTX *ctx) 1394. { 1395. BIGNUM *a, *b[2], *c, *d; test/bntest.c:1396:5: 1394. { 1395. BIGNUM *a, *b[2], *c, *d; 1396. > int i, j, ret = 0; 1397. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1398. int p1[] = { 193, 15, 0, -1 }; test/bntest.c:1397:5: 1395. BIGNUM *a, *b[2], *c, *d; 1396. int i, j, ret = 0; 1397. > int p0[] = { 163, 7, 6, 3, 0, -1 }; 1398. int p1[] = { 193, 15, 0, -1 }; 1399. test/bntest.c:1398:5: 1396. int i, j, ret = 0; 1397. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1398. > int p1[] = { 193, 15, 0, -1 }; 1399. 1400. a = BN_new(); test/bntest.c:1400:5: 1398. int p1[] = { 193, 15, 0, -1 }; 1399. 1400. > a = BN_new(); 1401. b[0] = BN_new(); 1402. 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:1401:5: 1399. 1400. a = BN_new(); 1401. > b[0] = BN_new(); 1402. b[1] = BN_new(); 1403. 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:1402:5: 1400. a = BN_new(); 1401. b[0] = BN_new(); 1402. > b[1] = BN_new(); 1403. c = BN_new(); 1404. 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:1403:5: 1401. b[0] = BN_new(); 1402. b[1] = BN_new(); 1403. > c = BN_new(); 1404. d = BN_new(); 1405. 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:1404:5: 1402. b[1] = BN_new(); 1403. c = BN_new(); 1404. > d = BN_new(); 1405. 1406. 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:1406:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1404. d = BN_new(); 1405. 1406. BN_GF2m_arr2poly(p0, b[0]); ^ 1407. BN_GF2m_arr2poly(p1, b[1]); 1408. test/bntest.c:1407:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1405. 1406. BN_GF2m_arr2poly(p0, b[0]); 1407. BN_GF2m_arr2poly(p1, b[1]); ^ 1408. 1409. for (i = 0; i < num0; i++) { test/bntest.c:1409:10: 1407. BN_GF2m_arr2poly(p1, b[1]); 1408. 1409. > for (i = 0; i < num0; i++) { 1410. BN_bntest_rand(a, 512, 0, 0); 1411. for (j = 0; j < 2; j++) { test/bntest.c:1409:17: Loop condition is false. Leaving loop 1407. BN_GF2m_arr2poly(p1, b[1]); 1408. 1409. for (i = 0; i < num0; i++) { ^ 1410. BN_bntest_rand(a, 512, 0, 0); 1411. for (j = 0; j < 2; j++) { test/bntest.c:1421:5: 1419. } 1420. } 1421. > ret = 1; 1422. err: 1423. BN_free(a); test/bntest.c:1422:2: 1420. } 1421. ret = 1; 1422. > err: 1423. BN_free(a); 1424. BN_free(b[0]); test/bntest.c:1423:5: 1421. ret = 1; 1422. err: 1423. > BN_free(a); 1424. BN_free(b[0]); 1425. 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/#L1423
d2a_code_trace_data_45007
static void JPEGFixupTagsSubsampling(TIFF* tif) { static const char module[] = "JPEGFixupTagsSubsampling"; struct JPEGFixupTagsSubsamplingData m; _TIFFFillStriles( tif ); if( tif->tif_dir.td_stripbytecount == NULL || tif->tif_dir.td_stripoffset == NULL || tif->tif_dir.td_stripbytecount[0] == 0 ) { return; } m.tif=tif; m.buffersize=2048; m.buffer=_TIFFmalloc(m.buffersize); if (m.buffer==NULL) { TIFFWarningExt(tif->tif_clientdata,module, "Unable to allocate memory for auto-correcting of subsampling values; auto-correcting skipped"); return; } m.buffercurrentbyte=NULL; m.bufferbytesleft=0; m.fileoffset=tif->tif_dir.td_stripoffset[0]; m.filepositioned=0; m.filebytesleft=tif->tif_dir.td_stripbytecount[0]; if (!JPEGFixupTagsSubsamplingSec(&m)) TIFFWarningExt(tif->tif_clientdata,module, "Unable to auto-correct subsampling values, likely corrupt JPEG compressed data in first strip/tile; auto-correcting skipped"); _TIFFfree(m.buffer); } libtiff/tif_jpeg.c:812: error: Memory Leak memory dynamically allocated by call to `_TIFFmalloc()` at line 800, column 11 is not reachable after line 812, column 7. libtiff/tif_jpeg.c:760:1: start of procedure JPEGFixupTagsSubsampling() 758. #ifdef CHECK_JPEG_YCBCR_SUBSAMPLING 759. 760. static void ^ 761. JPEGFixupTagsSubsampling(TIFF* tif) 762. { libtiff/tif_jpeg.c:783:2: 781. * Joris Van Damme, May 2007 782. */ 783. static const char module[] = "JPEGFixupTagsSubsampling"; ^ 784. struct JPEGFixupTagsSubsamplingData m; 785. libtiff/tif_jpeg.c:786:9: 784. struct JPEGFixupTagsSubsamplingData m; 785. 786. _TIFFFillStriles( tif ); ^ 787. 788. if( tif->tif_dir.td_stripbytecount == NULL libtiff/tif_dirread.c:5741:1: start of procedure _TIFFFillStriles() 5739. } 5740. 5741. int _TIFFFillStriles( TIFF *tif ) ^ 5742. { 5743. return _TIFFFillStrilesInternal( tif, 1 ); libtiff/tif_dirread.c:5743:5: 5741. int _TIFFFillStriles( TIFF *tif ) 5742. { 5743. return _TIFFFillStrilesInternal( tif, 1 ); ^ 5744. } 5745. libtiff/tif_dirread.c:5746:1: start of procedure _TIFFFillStrilesInternal() 5744. } 5745. 5746. static int _TIFFFillStrilesInternal( TIFF *tif, int loadStripByteCount ) ^ 5747. { 5748. #if defined(DEFER_STRILE_LOAD) libtiff/tif_dirread.c:5789:9: 5787. return return_value; 5788. #else /* !defined(DEFER_STRILE_LOAD) */ 5789. (void) tif; ^ 5790. (void) loadStripByteCount; 5791. return 1; libtiff/tif_dirread.c:5790:9: 5788. #else /* !defined(DEFER_STRILE_LOAD) */ 5789. (void) tif; 5790. (void) loadStripByteCount; ^ 5791. return 1; 5792. #endif libtiff/tif_dirread.c:5791:9: 5789. (void) tif; 5790. (void) loadStripByteCount; 5791. return 1; ^ 5792. #endif 5793. } libtiff/tif_dirread.c:5793:1: return from a call to _TIFFFillStrilesInternal 5791. return 1; 5792. #endif 5793. } ^ 5794. 5795. libtiff/tif_dirread.c:5744:1: return from a call to _TIFFFillStriles 5742. { 5743. return _TIFFFillStrilesInternal( tif, 1 ); 5744. } ^ 5745. 5746. static int _TIFFFillStrilesInternal( TIFF *tif, int loadStripByteCount ) libtiff/tif_jpeg.c:788:13: Taking false branch 786. _TIFFFillStriles( tif ); 787. 788. if( tif->tif_dir.td_stripbytecount == NULL ^ 789. || tif->tif_dir.td_stripoffset == NULL 790. || tif->tif_dir.td_stripbytecount[0] == 0 ) libtiff/tif_jpeg.c:789:16: Taking false branch 787. 788. if( tif->tif_dir.td_stripbytecount == NULL 789. || tif->tif_dir.td_stripoffset == NULL ^ 790. || tif->tif_dir.td_stripbytecount[0] == 0 ) 791. { libtiff/tif_jpeg.c:790:16: Taking false branch 788. if( tif->tif_dir.td_stripbytecount == NULL 789. || tif->tif_dir.td_stripoffset == NULL 790. || tif->tif_dir.td_stripbytecount[0] == 0 ) ^ 791. { 792. /* Do not even try to check if the first strip/tile does not libtiff/tif_jpeg.c:798:2: 796. } 797. 798. m.tif=tif; ^ 799. m.buffersize=2048; 800. m.buffer=_TIFFmalloc(m.buffersize); libtiff/tif_jpeg.c:799:2: 797. 798. m.tif=tif; 799. m.buffersize=2048; ^ 800. m.buffer=_TIFFmalloc(m.buffersize); 801. if (m.buffer==NULL) libtiff/tif_jpeg.c:800:2: 798. m.tif=tif; 799. m.buffersize=2048; 800. m.buffer=_TIFFmalloc(m.buffersize); ^ 801. if (m.buffer==NULL) 802. { libtiff/tif_unix.c:310:1: start of procedure _TIFFmalloc() 308. #endif 309. 310. void* ^ 311. _TIFFmalloc(tmsize_t s) 312. { libtiff/tif_unix.c:313:13: Taking false branch 311. _TIFFmalloc(tmsize_t s) 312. { 313. if (s == 0) ^ 314. return ((void *) NULL); 315. libtiff/tif_unix.c:316:2: 314. return ((void *) NULL); 315. 316. return (malloc((size_t) s)); ^ 317. } 318. libtiff/tif_unix.c:317:1: return from a call to _TIFFmalloc 315. 316. return (malloc((size_t) s)); 317. } ^ 318. 319. void* _TIFFcalloc(tmsize_t nmemb, tmsize_t siz) libtiff/tif_jpeg.c:801:6: Taking false branch 799. m.buffersize=2048; 800. m.buffer=_TIFFmalloc(m.buffersize); 801. if (m.buffer==NULL) ^ 802. { 803. TIFFWarningExt(tif->tif_clientdata,module, libtiff/tif_jpeg.c:807:2: 805. return; 806. } 807. m.buffercurrentbyte=NULL; ^ 808. m.bufferbytesleft=0; 809. m.fileoffset=tif->tif_dir.td_stripoffset[0]; libtiff/tif_jpeg.c:808:2: 806. } 807. m.buffercurrentbyte=NULL; 808. m.bufferbytesleft=0; ^ 809. m.fileoffset=tif->tif_dir.td_stripoffset[0]; 810. m.filepositioned=0; libtiff/tif_jpeg.c:809:2: 807. m.buffercurrentbyte=NULL; 808. m.bufferbytesleft=0; 809. m.fileoffset=tif->tif_dir.td_stripoffset[0]; ^ 810. m.filepositioned=0; 811. m.filebytesleft=tif->tif_dir.td_stripbytecount[0]; libtiff/tif_jpeg.c:810:2: 808. m.bufferbytesleft=0; 809. m.fileoffset=tif->tif_dir.td_stripoffset[0]; 810. m.filepositioned=0; ^ 811. m.filebytesleft=tif->tif_dir.td_stripbytecount[0]; 812. if (!JPEGFixupTagsSubsamplingSec(&m)) libtiff/tif_jpeg.c:811:2: 809. m.fileoffset=tif->tif_dir.td_stripoffset[0]; 810. m.filepositioned=0; 811. m.filebytesleft=tif->tif_dir.td_stripbytecount[0]; ^ 812. if (!JPEGFixupTagsSubsamplingSec(&m)) 813. TIFFWarningExt(tif->tif_clientdata,module, libtiff/tif_jpeg.c:812:7: Skipping JPEGFixupTagsSubsamplingSec(): empty list of specs 810. m.filepositioned=0; 811. m.filebytesleft=tif->tif_dir.td_stripbytecount[0]; 812. if (!JPEGFixupTagsSubsamplingSec(&m)) ^ 813. TIFFWarningExt(tif->tif_clientdata,module, 814. "Unable to auto-correct subsampling values, likely corrupt JPEG compressed data in first strip/tile; auto-correcting skipped");
https://gitlab.com/libtiff/libtiff/blob/6dac309a9701d15ac52d895d566ddae2ed49db9b/libtiff/tif_jpeg.c/#L812
d2a_code_trace_data_45008
static void dequant_lsps(double *lsps, int num, const uint16_t *values, const uint16_t *sizes, int n_stages, const uint8_t *table, const double *mul_q, const double *base_q) { int n, m; memset(lsps, 0, num * sizeof(*lsps)); for (n = 0; n < n_stages; n++) { const uint8_t *t_off = &table[values[n] * num]; double base = base_q[n], mul = mul_q[n]; for (m = 0; m < num; m++) lsps[m] += base + mul * t_off[m]; table += sizes[n] * num; } } libavcodec/wmavoice.c:1819: error: Buffer Overrun L1 Offset: [10, 17] (⇐ [10, 12] + [0, 5]) Size: 3 by call to `dequant_lsp16i`. libavcodec/wmavoice.c:1734:1: Array declaration 1732. * fully parse the superframe 1733. */ 1734. static int synth_superframe(AVCodecContext *ctx, AVFrame *frame, ^ 1735. int *got_frame_ptr) 1736. { libavcodec/wmavoice.c:1819:17: Call 1817. dequant_lsp10i(gb, lsps[n]); 1818. } else /* s->lsps == 16 */ 1819. dequant_lsp16i(gb, lsps[n]); ^ 1820. 1821. for (m = 0; m < s->lsps; m++) libavcodec/wmavoice.c:917:1: Parameter `*lsps` 915. * Parse 16 independently-coded LSPs. 916. */ 917. static void dequant_lsp16i(GetBitContext *gb, double *lsps) ^ 918. { 919. static const uint16_t vec_sizes[5] = { 256, 64, 128, 64, 128 }; libavcodec/wmavoice.c:942:5: Call 940. dequant_lsps(&lsps[5], 5, &v[2], &vec_sizes[2], 2, 941. wmavoice_dq_lsp16i2, &mul_lsf[2], &base_lsf[2]); 942. dequant_lsps(&lsps[10], 6, &v[4], &vec_sizes[4], 1, ^ 943. wmavoice_dq_lsp16i3, &mul_lsf[4], &base_lsf[4]); 944. } libavcodec/wmavoice.c:823:1: <Offset trace> 821. * @param base_q base (lowest) LSF values 822. */ 823. static void dequant_lsps(double *lsps, int num, ^ 824. const uint16_t *values, 825. const uint16_t *sizes, libavcodec/wmavoice.c:823:1: Parameter `num` 821. * @param base_q base (lowest) LSF values 822. */ 823. static void dequant_lsps(double *lsps, int num, ^ 824. const uint16_t *values, 825. const uint16_t *sizes, libavcodec/wmavoice.c:823:1: <Length trace> 821. * @param base_q base (lowest) LSF values 822. */ 823. static void dequant_lsps(double *lsps, int num, ^ 824. const uint16_t *values, 825. const uint16_t *sizes, libavcodec/wmavoice.c:823:1: Parameter `*lsps` 821. * @param base_q base (lowest) LSF values 822. */ 823. static void dequant_lsps(double *lsps, int num, ^ 824. const uint16_t *values, 825. const uint16_t *sizes, libavcodec/wmavoice.c:838:13: Array access: Offset: [10, 17] (⇐ [10, 12] + [0, 5]) Size: 3 by call to `dequant_lsp16i` 836. 837. for (m = 0; m < num; m++) 838. lsps[m] += base + mul * t_off[m]; ^ 839. 840. table += sizes[n] * num;
https://github.com/libav/libav/blob/c6507946d428ee082676d5917fbb3eb0d1d7eb2e/libavcodec/wmavoice.c/#L838
d2a_code_trace_data_45009
static int t_fromb64(unsigned char *a, size_t alen, const char *src) { char *loc; int i, j; int size; while (*src && (*src == ' ' || *src == '\t' || *src == '\n')) ++src; size = strlen(src); if (alen > INT_MAX || size > (int)alen) return -1; i = 0; while (i < size) { loc = strchr(b64table, src[i]); if (loc == (char *)0) break; else a[i] = loc - b64table; ++i; } if (i == 0) return 0; size = i; i = size - 1; j = size; while (1) { a[j] = a[i]; if (--i < 0) break; a[j] |= (a[i] & 3) << 6; --j; a[j] = (unsigned char)((a[i] & 0x3c) >> 2); if (--i < 0) break; a[j] |= (a[i] & 0xf) << 4; --j; a[j] = (unsigned char)((a[i] & 0x30) >> 4); if (--i < 0) break; a[j] |= (a[i] << 2); a[--j] = 0; if (--i < 0) break; } while (a[j] == 0 && j <= size) ++j; i = 0; while (j <= size) a[i++] = a[j++]; return i; } crypto/srp/srp_vfy.c:411: error: BUFFER_OVERRUN_L2 Offset: [-oo, 2147483648] Size: 2500 by call to `SRP_user_pwd_set_sv`. Showing all 12 steps of the trace crypto/srp/srp_vfy.c:365:18: Call 363. error_code = SRP_ERR_VBASE_INCOMPLETE_FILE; 364. 365. if ((tmpdb = TXT_DB_read(in, DB_NUMBER)) == NULL) ^ 366. goto err; 367. crypto/txt_db/txt_db.c:55:5: Assignment 53. add = (num + 1) * sizeof(char *); 54. buf->data[size - 1] = '\0'; 55. offset = 0; ^ 56. for (;;) { 57. if (offset != 0) { crypto/srp/srp_vfy.c:411:22: Call 409. 410. error_code = SRP_ERR_VBASE_BN_LIB; 411. if (!SRP_user_pwd_set_sv ^ 412. (user_pwd, pp[DB_srpsalt], pp[DB_srpverifier])) 413. goto err; crypto/srp/srp_vfy.c:181:1: Array declaration 179. } 180. 181. > static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s, 182. const char *v) 183. { crypto/srp/srp_vfy.c:190:11: Call 188. vinfo->s = NULL; 189. 190. len = t_fromb64(tmp, sizeof(tmp), v); ^ 191. if (len < 0) 192. return 0; crypto/srp/srp_vfy.c:33:1: <Offset trace> 31. * Convert a base64 string into raw byte array representation. 32. */ 33. > static int t_fromb64(unsigned char *a, size_t alen, const char *src) 34. { 35. char *loc; crypto/srp/srp_vfy.c:33:1: Parameter `alen` 31. * Convert a base64 string into raw byte array representation. 32. */ 33. > static int t_fromb64(unsigned char *a, size_t alen, const char *src) 34. { 35. char *loc; crypto/srp/srp_vfy.c:57:5: Assignment 55. if (i == 0) 56. return 0; 57. size = i; ^ 58. i = size - 1; 59. j = size; crypto/srp/srp_vfy.c:59:5: Assignment 57. size = i; 58. i = size - 1; 59. j = size; ^ 60. while (1) { 61. a[j] = a[i]; crypto/srp/srp_vfy.c:33:1: <Length trace> 31. * Convert a base64 string into raw byte array representation. 32. */ 33. > static int t_fromb64(unsigned char *a, size_t alen, const char *src) 34. { 35. char *loc; crypto/srp/srp_vfy.c:33:1: Parameter `*a` 31. * Convert a base64 string into raw byte array representation. 32. */ 33. > static int t_fromb64(unsigned char *a, size_t alen, const char *src) 34. { 35. char *loc; crypto/srp/srp_vfy.c:80:12: Array access: Offset: [-oo, 2147483648] Size: 2500 by call to `SRP_user_pwd_set_sv` 78. break; 79. } 80. while (a[j] == 0 && j <= size) ^ 81. ++j; 82. i = 0;
https://github.com/openssl/openssl/blob/9dd4ac8cf17f2afd636e85ae0111d1df4104a475/crypto/srp/srp_vfy.c/#L80
d2a_code_trace_data_45010
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/ec/ecdsa_ossl.c:232: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `bn_to_mont_fixed_top`. Showing all 23 steps of the trace crypto/ec/ecdsa_ossl.c:201:10: Call 199. if (8 * dgst_len > i) 200. dgst_len = (i + 7) / 8; 201. if (!BN_bin2bn(dgst, dgst_len, m)) { ^ 202. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); 203. 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:232:14: Call 230. * below, returns user-visible value with removed zero padding. 231. */ 232. if (!bn_to_mont_fixed_top(s, ret->r, group->mont_data, ctx) ^ 233. || !bn_mul_mont_fixed_top(s, s, priv_key, group->mont_data, ctx)) { 234. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); crypto/bn/bn_mont.c:222:1: Parameter `r->top` 220. } 221. 222. > int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 223. BN_CTX *ctx) 224. { crypto/bn/bn_mont.c:225:12: Call 223. BN_CTX *ctx) 224. { 225. return bn_mul_mont_fixed_top(r, a, &(mont->RR), mont, ctx); ^ 226. } 227. crypto/bn/bn_mont.c:37:1: Parameter `r->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:46:13: Call 44. #if defined(OPENSSL_BN_ASM_MONT) && defined(MONT_WORD) 45. if (num > 1 && a->top == num && b->top == num) { 46. if (bn_wexpand(r, num) == NULL) ^ 47. return 0; 48. if (bn_mul_mont(r->d, a->d, b->d, mont->N.d, mont->n0, num)) { crypto/bn/bn_lib.c:960:1: Parameter `a->top` 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->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_to_mont_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_45011
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1269: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_sqr`. Showing all 13 steps of the trace test/bntest.c:1269:10: Call 1267. 1268. BN_zero(zero); 1269. if (!TEST_true(BN_sqr(ret, a, ctx)) ^ 1270. || !equalBN("A^2", square, ret) 1271. || !TEST_true(BN_mul(ret, a, a, ctx)) crypto/bn/bn_sqr.c:17:1: Parameter `ctx->stack.depth` 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 ret = bn_sqr_fixed_top(r, a, ctx); crypto/bn/bn_sqr.c:19:15: Call 17. int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int ret = bn_sqr_fixed_top(r, a, ctx); ^ 20. 21. bn_correct_top(r); crypto/bn/bn_sqr.c:42:5: Call 40. } 41. 42. BN_CTX_start(ctx); ^ 43. rr = (a != r) ? r : BN_CTX_get(ctx); 44. 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_sqr.c:104:5: Call 102. bn_check_top(rr); 103. bn_check_top(tmp); 104. BN_CTX_end(ctx); ^ 105. return ret; 106. } 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_sqr` 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_45012
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:3183: error: Uninitialized Value The value read from is_intra[_] was never initialized. libavcodec/vc1.c:3183:17: 3181. dst_idx += i >> 2; 3182. off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); 3183. s->mb_intra = is_intra[i]; ^ 3184. if (is_intra[i]) { 3185. /* check if prediction blocks A and C are available */
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vc1.c/#L3183
d2a_code_trace_data_45013
MSG_PROCESS_RETURN tls_process_client_hello(SSL *s, PACKET *pkt) { int al = SSL_AD_INTERNAL_ERROR; PACKET session_id, compression, extensions, cookie; static const unsigned char null_compression = 0; CLIENTHELLO_MSG *clienthello; clienthello = OPENSSL_zalloc(sizeof(*clienthello)); if (clienthello == NULL) { SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); goto err; } if (s->renegotiate == 0 && !SSL_IS_FIRST_HANDSHAKE(s)) { s->renegotiate = 1; s->new_session = 1; } clienthello->isv2 = RECORD_LAYER_is_sslv2_record(&s->rlayer); PACKET_null_init(&cookie); if (clienthello->isv2) { unsigned int mt; if (!SSL_IS_FIRST_HANDSHAKE(s) || s->hello_retry_request) { al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, SSL_R_UNEXPECTED_MESSAGE); goto f_err; } if (!PACKET_get_1(pkt, &mt) || mt != SSL2_MT_CLIENT_HELLO) { SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); goto err; } } if (!PACKET_get_net_2(pkt, &clienthello->legacy_version)) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, SSL_R_LENGTH_TOO_SHORT); goto err; } if (clienthello->isv2) { unsigned int ciphersuite_len, session_id_len, challenge_len; PACKET challenge; if (!PACKET_get_net_2(pkt, &ciphersuite_len) || !PACKET_get_net_2(pkt, &session_id_len) || !PACKET_get_net_2(pkt, &challenge_len)) { SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, SSL_R_RECORD_LENGTH_MISMATCH); al = SSL_AD_DECODE_ERROR; goto f_err; } if (session_id_len > SSL_MAX_SSL_SESSION_ID_LENGTH) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, SSL_R_LENGTH_MISMATCH); goto f_err; } if (!PACKET_get_sub_packet(pkt, &clienthello->ciphersuites, ciphersuite_len) || !PACKET_copy_bytes(pkt, clienthello->session_id, session_id_len) || !PACKET_get_sub_packet(pkt, &challenge, challenge_len) || PACKET_remaining(pkt) != 0) { SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, SSL_R_RECORD_LENGTH_MISMATCH); al = SSL_AD_DECODE_ERROR; goto f_err; } clienthello->session_id_len = session_id_len; challenge_len = challenge_len > SSL3_RANDOM_SIZE ? SSL3_RANDOM_SIZE : challenge_len; memset(clienthello->random, 0, SSL3_RANDOM_SIZE); if (!PACKET_copy_bytes(&challenge, clienthello->random + SSL3_RANDOM_SIZE - challenge_len, challenge_len) || !PACKET_buf_init(&compression, &null_compression, 1)) { SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); al = SSL_AD_INTERNAL_ERROR; goto f_err; } PACKET_null_init(&clienthello->extensions); } else { if (!PACKET_copy_bytes(pkt, clienthello->random, SSL3_RANDOM_SIZE) || !PACKET_get_length_prefixed_1(pkt, &session_id) || !PACKET_copy_all(&session_id, clienthello->session_id, SSL_MAX_SSL_SESSION_ID_LENGTH, &clienthello->session_id_len)) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, SSL_R_LENGTH_MISMATCH); goto f_err; } if (SSL_IS_DTLS(s)) { if (!PACKET_get_length_prefixed_1(pkt, &cookie)) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, SSL_R_LENGTH_MISMATCH); goto f_err; } if (!PACKET_copy_all(&cookie, clienthello->dtls_cookie, DTLS1_COOKIE_LENGTH, &clienthello->dtls_cookie_len)) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, SSL_R_LENGTH_MISMATCH); goto f_err; } if (SSL_get_options(s) & SSL_OP_COOKIE_EXCHANGE) { if (clienthello->dtls_cookie_len == 0) return 1; } } if (!PACKET_get_length_prefixed_2(pkt, &clienthello->ciphersuites)) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, SSL_R_LENGTH_MISMATCH); goto f_err; } if (!PACKET_get_length_prefixed_1(pkt, &compression)) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, SSL_R_LENGTH_MISMATCH); goto f_err; } if (PACKET_remaining(pkt) == 0) { PACKET_null_init(&clienthello->extensions); } else { if (!PACKET_get_length_prefixed_2(pkt, &clienthello->extensions)) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, SSL_R_LENGTH_MISMATCH); goto f_err; } } } if (!PACKET_copy_all(&compression, clienthello->compressions, MAX_COMPRESSIONS_SIZE, &clienthello->compressions_len)) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, SSL_R_LENGTH_MISMATCH); goto f_err; } extensions = clienthello->extensions; if (!tls_collect_extensions(s, &extensions, SSL_EXT_CLIENT_HELLO, &clienthello->pre_proc_exts, &al, &clienthello->pre_proc_exts_len, 1)) { goto f_err; } s->clienthello = clienthello; return MSG_PROCESS_CONTINUE_PROCESSING; f_err: ssl3_send_alert(s, SSL3_AL_FATAL, al); err: ossl_statem_set_error(s); OPENSSL_free(clienthello->pre_proc_exts); OPENSSL_free(clienthello); return MSG_PROCESS_ERROR; } ssl/statem/statem_srvr.c:1442: error: NULL_DEREFERENCE pointer `clienthello` last assigned on line 1242 could be null and is dereferenced at line 1442, column 5. Showing all 27 steps of the trace ssl/statem/statem_srvr.c:1234:1: start of procedure tls_process_client_hello() 1232. #endif /* !OPENSSL_NO_EC */ 1233. 1234. > MSG_PROCESS_RETURN tls_process_client_hello(SSL *s, PACKET *pkt) 1235. { 1236. int al = SSL_AD_INTERNAL_ERROR; ssl/statem/statem_srvr.c:1236:5: 1234. MSG_PROCESS_RETURN tls_process_client_hello(SSL *s, PACKET *pkt) 1235. { 1236. > int al = SSL_AD_INTERNAL_ERROR; 1237. /* |cookie| will only be initialized for DTLS. */ 1238. PACKET session_id, compression, extensions, cookie; ssl/statem/statem_srvr.c:1239:5: 1237. /* |cookie| will only be initialized for DTLS. */ 1238. PACKET session_id, compression, extensions, cookie; 1239. > static const unsigned char null_compression = 0; 1240. CLIENTHELLO_MSG *clienthello; 1241. ssl/statem/statem_srvr.c:1242:5: 1240. CLIENTHELLO_MSG *clienthello; 1241. 1242. > clienthello = OPENSSL_zalloc(sizeof(*clienthello)); 1243. if (clienthello == NULL) { 1244. SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); crypto/mem.c:186:1: start of procedure CRYPTO_zalloc() 184. } 185. 186. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:188:5: 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. > void *ret = CRYPTO_malloc(num, file, line); 189. 190. FAILTEST(); crypto/mem.c:158:1: start of procedure CRYPTO_malloc() 156. #endif 157. 158. > void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. void *ret = NULL; crypto/mem.c:160:5: 158. void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. > void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:162:9: Taking false branch 160. void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 163. return malloc_impl(num, file, line); 164. crypto/mem.c:165:9: Taking false branch 163. return malloc_impl(num, file, line); 164. 165. if (num == 0) ^ 166. return NULL; 167. crypto/mem.c:169:5: 167. 168. FAILTEST(); 169. > allow_customize = 0; 170. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 171. if (call_malloc_debug) { crypto/mem.c:179:5: 177. } 178. #else 179. > osslargused(file); osslargused(line); 180. ret = malloc(num); 181. #endif crypto/mem.c:179:24: 177. } 178. #else 179. > osslargused(file); osslargused(line); 180. ret = malloc(num); 181. #endif crypto/mem.c:180:5: 178. #else 179. osslargused(file); osslargused(line); 180. > ret = malloc(num); 181. #endif 182. crypto/mem.c:183:5: 181. #endif 182. 183. > return ret; 184. } 185. crypto/mem.c:184:1: return from a call to CRYPTO_malloc 182. 183. return ret; 184. > } 185. 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:191:9: Taking false branch 189. 190. FAILTEST(); 191. if (ret != NULL) ^ 192. memset(ret, 0, num); 193. return ret; crypto/mem.c:193:5: 191. if (ret != NULL) 192. memset(ret, 0, num); 193. > return ret; 194. } 195. crypto/mem.c:194:1: return from a call to CRYPTO_zalloc 192. memset(ret, 0, num); 193. return ret; 194. > } 195. 196. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) ssl/statem/statem_srvr.c:1243:9: Taking true branch 1241. 1242. clienthello = OPENSSL_zalloc(sizeof(*clienthello)); 1243. if (clienthello == NULL) { ^ 1244. SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); 1245. goto err; ssl/statem/statem_srvr.c:1244:9: Skipping ERR_put_error(): empty list of specs 1242. clienthello = OPENSSL_zalloc(sizeof(*clienthello)); 1243. if (clienthello == NULL) { 1244. SSLerr(SSL_F_TLS_PROCESS_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); ^ 1245. goto err; 1246. } ssl/statem/statem_srvr.c:1439:2: 1437. f_err: 1438. ssl3_send_alert(s, SSL3_AL_FATAL, al); 1439. > err: 1440. ossl_statem_set_error(s); 1441. ssl/statem/statem_srvr.c:1440:5: 1438. ssl3_send_alert(s, SSL3_AL_FATAL, al); 1439. err: 1440. > ossl_statem_set_error(s); 1441. 1442. OPENSSL_free(clienthello->pre_proc_exts); ssl/statem/statem.c:116:1: start of procedure ossl_statem_set_error() 114. * the current connection. 115. */ 116. > void ossl_statem_set_error(SSL *s) 117. { 118. s->statem.state = MSG_FLOW_ERROR; ssl/statem/statem.c:118:5: 116. void ossl_statem_set_error(SSL *s) 117. { 118. > s->statem.state = MSG_FLOW_ERROR; 119. } 120. ssl/statem/statem.c:119:1: return from a call to ossl_statem_set_error 117. { 118. s->statem.state = MSG_FLOW_ERROR; 119. > } 120. 121. /* ssl/statem/statem_srvr.c:1442:5: 1440. ossl_statem_set_error(s); 1441. 1442. > OPENSSL_free(clienthello->pre_proc_exts); 1443. OPENSSL_free(clienthello); 1444.
https://github.com/openssl/openssl/blob/84c34ba8762463057d372e22ad98a045dbd9a51f/ssl/statem/statem_srvr.c/#L1442
d2a_code_trace_data_45014
ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, char *value) { BIGNUM *bn = NULL; ASN1_INTEGER *aint; int isneg, ishex; int ret; if (value == NULL) { X509V3err(X509V3_F_S2I_ASN1_INTEGER, X509V3_R_INVALID_NULL_VALUE); return NULL; } bn = BN_new(); if (bn == NULL) { X509V3err(X509V3_F_S2I_ASN1_INTEGER, ERR_R_MALLOC_FAILURE); return NULL; } if (value[0] == '-') { value++; isneg = 1; } else isneg = 0; if (value[0] == '0' && ((value[1] == 'x') || (value[1] == 'X'))) { value += 2; ishex = 1; } else ishex = 0; if (ishex) ret = BN_hex2bn(&bn, value); else ret = BN_dec2bn(&bn, value); if (!ret || value[ret]) { BN_free(bn); X509V3err(X509V3_F_S2I_ASN1_INTEGER, X509V3_R_BN_DEC2BN_ERROR); return NULL; } if (isneg && BN_is_zero(bn)) isneg = 0; aint = BN_to_ASN1_INTEGER(bn, NULL); BN_free(bn); if (!aint) { X509V3err(X509V3_F_S2I_ASN1_INTEGER, X509V3_R_BN_TO_ASN1_INTEGER_ERROR); return NULL; } if (isneg) aint->type |= V_ASN1_NEG; return aint; } crypto/x509v3/v3_utl.c:203: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 183, column 10 is not reachable after line 203, column 15. Showing all 34 steps of the trace crypto/x509v3/v3_utl.c:173:1: start of procedure s2i_ASN1_INTEGER() 171. } 172. 173. > ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, char *value) 174. { 175. BIGNUM *bn = NULL; crypto/x509v3/v3_utl.c:175:5: 173. ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, char *value) 174. { 175. > BIGNUM *bn = NULL; 176. ASN1_INTEGER *aint; 177. int isneg, ishex; crypto/x509v3/v3_utl.c:179:9: Taking false branch 177. int isneg, ishex; 178. int ret; 179. if (value == NULL) { ^ 180. X509V3err(X509V3_F_S2I_ASN1_INTEGER, X509V3_R_INVALID_NULL_VALUE); 181. return NULL; crypto/x509v3/v3_utl.c:183:5: 181. return NULL; 182. } 183. > bn = BN_new(); 184. if (bn == NULL) { 185. X509V3err(X509V3_F_S2I_ASN1_INTEGER, ERR_R_MALLOC_FAILURE); 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) crypto/x509v3/v3_utl.c:184:9: Taking false branch 182. } 183. bn = BN_new(); 184. if (bn == NULL) { ^ 185. X509V3err(X509V3_F_S2I_ASN1_INTEGER, ERR_R_MALLOC_FAILURE); 186. return NULL; crypto/x509v3/v3_utl.c:188:9: Taking false branch 186. return NULL; 187. } 188. if (value[0] == '-') { ^ 189. value++; 190. isneg = 1; crypto/x509v3/v3_utl.c:192:9: 190. isneg = 1; 191. } else 192. > isneg = 0; 193. 194. if (value[0] == '0' && ((value[1] == 'x') || (value[1] == 'X'))) { crypto/x509v3/v3_utl.c:194:9: Taking true branch 192. isneg = 0; 193. 194. if (value[0] == '0' && ((value[1] == 'x') || (value[1] == 'X'))) { ^ 195. value += 2; 196. ishex = 1; crypto/x509v3/v3_utl.c:194:30: Taking false branch 192. isneg = 0; 193. 194. if (value[0] == '0' && ((value[1] == 'x') || (value[1] == 'X'))) { ^ 195. value += 2; 196. ishex = 1; crypto/x509v3/v3_utl.c:194:51: Taking false branch 192. isneg = 0; 193. 194. if (value[0] == '0' && ((value[1] == 'x') || (value[1] == 'X'))) { ^ 195. value += 2; 196. ishex = 1; crypto/x509v3/v3_utl.c:198:9: 196. ishex = 1; 197. } else 198. > ishex = 0; 199. 200. if (ishex) crypto/x509v3/v3_utl.c:200:9: Taking false branch 198. ishex = 0; 199. 200. if (ishex) ^ 201. ret = BN_hex2bn(&bn, value); 202. else crypto/x509v3/v3_utl.c:203:9: Skipping BN_dec2bn(): empty list of specs 201. ret = BN_hex2bn(&bn, value); 202. else 203. ret = BN_dec2bn(&bn, value); ^ 204. 205. if (!ret || value[ret]) {
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/x509v3/v3_utl.c/#L203
d2a_code_trace_data_45015
int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, const char *dir) { DIR *d; struct dirent *dstruct; int ret = 0; CRYPTO_w_lock(CRYPTO_LOCK_READDIR); d = opendir(dir); if(!d) { SYSerr(SYS_F_OPENDIR, get_last_sys_error()); ERR_add_error_data(3, "opendir('", dir, "')"); SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB); goto err; } while((dstruct=readdir(d))) { char buf[1024]; int r; if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf) { SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG); goto err; } r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name); if (r <= 0 || r >= sizeof buf) goto err; if(!SSL_add_file_cert_subjects_to_stack(stack,buf)) goto err; } ret = 1; err: CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); return ret; } ssl/ssl_cert.c:741: error: RESOURCE_LEAK resource acquired by call to `opendir()` at line 718, column 6 is not released after line 741, column 7. Showing all 22 steps of the trace ssl/ssl_cert.c:710:1: start of procedure SSL_add_dir_cert_subjects_to_stack() 708. #ifndef MAC_OS_pre_X 709. 710. > int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, 711. const char *dir) 712. { ssl/ssl_cert.c:715:2: 713. DIR *d; 714. struct dirent *dstruct; 715. > int ret = 0; 716. 717. CRYPTO_w_lock(CRYPTO_LOCK_READDIR); ssl/ssl_cert.c:717:2: 715. int ret = 0; 716. 717. > CRYPTO_w_lock(CRYPTO_LOCK_READDIR); 718. d = opendir(dir); 719. crypto/cryptlib.c:198:1: start of procedure CRYPTO_lock() 196. } 197. 198. > void CRYPTO_lock(int mode, int type, const char *file, int line) 199. { 200. #ifdef LOCK_DEBUG crypto/cryptlib.c:223:6: Taking true branch 221. } 222. #endif 223. if (locking_callback != NULL) ^ 224. locking_callback(mode,type,file,line); 225. } crypto/cryptlib.c:224:3: Skipping __function_pointer__(): unresolved function pointer 222. #endif 223. if (locking_callback != NULL) 224. locking_callback(mode,type,file,line); ^ 225. } 226. crypto/cryptlib.c:223:2: 221. } 222. #endif 223. > if (locking_callback != NULL) 224. locking_callback(mode,type,file,line); 225. } crypto/cryptlib.c:225:2: return from a call to CRYPTO_lock 223. if (locking_callback != NULL) 224. locking_callback(mode,type,file,line); 225. } ^ 226. 227. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, ssl/ssl_cert.c:718:2: 716. 717. CRYPTO_w_lock(CRYPTO_LOCK_READDIR); 718. > d = opendir(dir); 719. 720. /* Note that a side effect is that the CAs will be sorted by name */ ssl/ssl_cert.c:721:6: Taking false branch 719. 720. /* Note that a side effect is that the CAs will be sorted by name */ 721. if(!d) ^ 722. { 723. SYSerr(SYS_F_OPENDIR, get_last_sys_error()); ssl/ssl_cert.c:729:9: Loop condition is true. Entering loop body 727. } 728. 729. while((dstruct=readdir(d))) ^ 730. { 731. char buf[1024]; ssl/ssl_cert.c:734:6: Taking false branch 732. int r; 733. 734. if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf) ^ 735. { 736. SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG); ssl/ssl_cert.c:740:3: 738. } 739. 740. > r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name); 741. if (r <= 0 || r >= sizeof buf) 742. goto err; crypto/bio/b_print.c:849:1: start of procedure BIO_snprintf() 847. * to BIO_printf, and we need *some* name prefix ... 848. * (XXX the function should be renamed, but to what?) */ 849. > int BIO_snprintf(char *buf, size_t n, const char *format, ...) 850. { 851. va_list args; crypto/bio/b_print.c:855:2: 853. int truncated; 854. 855. > va_start(args, format); 856. _dopr(dopr_outch, dopr_isbig, dopr_copy, 857. &buf, &n, &retlen, &truncated, format, args); crypto/bio/b_print.c:856:2: Skipping _dopr(): empty list of specs 854. 855. va_start(args, format); 856. _dopr(dopr_outch, dopr_isbig, dopr_copy, ^ 857. &buf, &n, &retlen, &truncated, format, args); 858. if (truncated) crypto/bio/b_print.c:858:6: Taking false branch 856. _dopr(dopr_outch, dopr_isbig, dopr_copy, 857. &buf, &n, &retlen, &truncated, format, args); 858. if (truncated) ^ 859. /* In case of truncation, return -1 like traditional snprintf. 860. * (Current drafts for ISO/IEC 9899 say snprintf should return crypto/bio/b_print.c:865:11: Condition is true 863. return -1; 864. else 865. return (retlen <= INT_MAX) ? retlen : -1; ^ 866. } crypto/bio/b_print.c:865:10: 863. return -1; 864. else 865. > return (retlen <= INT_MAX) ? retlen : -1; 866. } crypto/bio/b_print.c:865:3: 863. return -1; 864. else 865. > return (retlen <= INT_MAX) ? retlen : -1; 866. } crypto/bio/b_print.c:866:2: return from a call to BIO_snprintf 864. else 865. return (retlen <= INT_MAX) ? retlen : -1; 866. } ^ ssl/ssl_cert.c:741:7: Taking true branch 739. 740. r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name); 741. if (r <= 0 || r >= sizeof buf) ^ 742. goto err; 743. if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
https://github.com/openssl/openssl/blob/4d29312ce198d00a69c4b0bf572c0de46778ecc9/ssl/ssl_cert.c/#L741
d2a_code_trace_data_45016
static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) { const char *s = *t; int64_t v = 0; if (*s == '9' || *s == '8' || !ossl_isdigit(*s)) return 0; do { v = (v << 3) + (*s - '0'); } while (ossl_isdigit(*++s) && *s != '9' && *s != '8'); if (!ossl_isspace(*s) && *s != '\0' && *s != ',') { ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_OCTAL_DIGIT, "HERE-->%s", *t); return 0; } *t = skip_space(s); res->type = PROPERTY_TYPE_NUMBER; res->v.int_val = v; return 1; } test/property_test.c:311: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 37] by call to `ossl_method_store_add`. Showing all 23 steps of the trace test/property_test.c:277:9: Array declaration 275. char *impl; 276. } impls[] = { 277. { 1, "fast=no, colour=green", "a" }, ^ 278. { 1, "fast, colour=blue", "b" }, 279. { 1, "", "-" }, test/property_test.c:311:14: Call 309. 310. for (i = 0; i < OSSL_NELEM(impls); i++) 311. if (!TEST_true(ossl_method_store_add(store, NULL, impls[i].nid, ^ 312. impls[i].prop, impls[i].impl, 313. NULL, NULL))) { crypto/property/property.c:177:1: Parameter `*properties` 175. } 176. 177. > int ossl_method_store_add(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov, 178. int nid, const char *properties, void *method, 179. int (*method_up_ref)(void *), crypto/property/property.c:213:28: Call 211. ossl_method_cache_flush(store, nid); 212. if ((impl->properties = ossl_prop_defn_get(store->ctx, properties)) == NULL) { 213. impl->properties = ossl_parse_property(store->ctx, properties); ^ 214. if (impl->properties == NULL) 215. goto err; crypto/property/property_parse.c:329:1: Parameter `*defn` 327. } 328. 329. > OSSL_PROPERTY_LIST *ossl_parse_property(OPENSSL_CTX *ctx, const char *defn) 330. { 331. PROPERTY_DEFINITION *prop = NULL; crypto/property/property_parse.c:334:5: Assignment 332. OSSL_PROPERTY_LIST *res = NULL; 333. STACK_OF(PROPERTY_DEFINITION) *sk; 334. const char *s = defn; ^ 335. int done; 336. crypto/property/property_parse.c:340:9: Call 338. return NULL; 339. 340. s = skip_space(s); ^ 341. done = *s == '\0'; 342. while (!done) { crypto/property/property_parse.c:52:1: Parameter `*s` 50. DEFINE_STACK_OF(PROPERTY_DEFINITION) 51. 52. > static const char *skip_space(const char *s) 53. { 54. while (ossl_isspace(*s)) crypto/property/property_parse.c:56:5: Assignment 54. while (ossl_isspace(*s)) 55. s++; 56. return s; ^ 57. } 58. crypto/property/property_parse.c:340:5: Assignment 338. return NULL; 339. 340. s = skip_space(s); ^ 341. done = *s == '\0'; 342. while (!done) { crypto/property/property_parse.c:350:14: Call 348. memset(&prop->v, 0, sizeof(prop->v)); 349. prop->optional = 0; 350. if (!parse_name(ctx, &s, 1, &prop->name_idx)) ^ 351. goto err; 352. prop->oper = PROPERTY_OPER_EQ; crypto/property/property_parse.c:83:1: Parameter `**t` 81. } 82. 83. > static int parse_name(OPENSSL_CTX *ctx, const char *t[], int create, 84. OSSL_PROPERTY_IDX *idx) 85. { crypto/property/property_parse.c:358:13: Call 356. goto err; 357. } 358. if (match_ch(&s, '=')) { ^ 359. if (!parse_value(ctx, &s, prop, 1)) { 360. ERR_raise_data(ERR_LIB_PROP, PROP_R_NO_VALUE, crypto/property/property_parse.c:59:1: Parameter `**t` 57. } 58. 59. > static int match_ch(const char *t[], char m) 60. { 61. const char *s = *t; crypto/property/property_parse.c:359:18: Call 357. } 358. if (match_ch(&s, '=')) { 359. if (!parse_value(ctx, &s, prop, 1)) { ^ 360. ERR_raise_data(ERR_LIB_PROP, PROP_R_NO_VALUE, 361. "HERE-->%s", start); crypto/property/property_parse.c:254:1: Parameter `**t` 252. } 253. 254. > static int parse_value(OPENSSL_CTX *ctx, const char *t[], 255. PROPERTY_DEFINITION *res, int create) 256. { crypto/property/property_parse.c:257:5: Assignment 255. PROPERTY_DEFINITION *res, int create) 256. { 257. const char *s = *t; ^ 258. int r = 0; 259. crypto/property/property_parse.c:274:9: Assignment 272. r = parse_hex(&s, res); 273. } else if (*s == '0' && ossl_isdigit(s[1])) { 274. s++; ^ 275. r = parse_oct(&s, res); 276. } else if (ossl_isdigit(*s)) { crypto/property/property_parse.c:275:13: Call 273. } else if (*s == '0' && ossl_isdigit(s[1])) { 274. s++; 275. r = parse_oct(&s, res); ^ 276. } else if (ossl_isdigit(*s)) { 277. return parse_number(t, res); crypto/property/property_parse.c:169:1: <Length trace> 167. } 168. 169. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 170. { 171. const char *s = *t; crypto/property/property_parse.c:169:1: Parameter `**t` 167. } 168. 169. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 170. { 171. const char *s = *t; crypto/property/property_parse.c:171:5: Assignment 169. static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 170. { 171. const char *s = *t; ^ 172. int64_t v = 0; 173. crypto/property/property_parse.c:178:14: Array access: Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 37] by call to `ossl_method_store_add` 176. do { 177. v = (v << 3) + (*s - '0'); 178. } while (ossl_isdigit(*++s) && *s != '9' && *s != '8'); ^ 179. if (!ossl_isspace(*s) && *s != '\0' && *s != ',') { 180. ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_OCTAL_DIGIT,
https://github.com/openssl/openssl/blob/c1d56231ef6385b557ec72eec508e55ea26ca8b0/crypto/property/property_parse.c/#L178
d2a_code_trace_data_45017
void av_close_input_stream(AVFormatContext *s) { int i; AVStream *st; if (s->iformat->read_close) s->iformat->read_close(s); for(i=0;i<s->nb_streams;i++) { st = s->streams[i]; if (st->parser) { av_parser_close(st->parser); av_free_packet(&st->cur_pkt); } av_metadata_free(&st->metadata); av_free(st->index_entries); av_free(st->codec->extradata); av_free(st->codec); #if LIBAVFORMAT_VERSION_INT < (53<<16) av_free(st->filename); #endif av_free(st->priv_data); av_free(st); } for(i=s->nb_programs-1; i>=0; i--) { #if LIBAVFORMAT_VERSION_INT < (53<<16) av_freep(&s->programs[i]->provider_name); av_freep(&s->programs[i]->name); #endif av_metadata_free(&s->programs[i]->metadata); av_freep(&s->programs[i]->stream_index); av_freep(&s->programs[i]); } av_freep(&s->programs); flush_packet_queue(s); av_freep(&s->priv_data); while(s->nb_chapters--) { #if LIBAVFORMAT_VERSION_INT < (53<<16) av_free(s->chapters[s->nb_chapters]->title); #endif av_metadata_free(&s->chapters[s->nb_chapters]->metadata); av_free(s->chapters[s->nb_chapters]); } av_freep(&s->chapters); av_metadata_free(&s->metadata); av_free(s); } ffserver.c:2754: error: Integer Overflow L2 ([0, 1] - 1):unsigned32 by call to `av_close_input_stream`. ffserver.c:2751:17: Call 2749. AVStream *fst = feed->streams[i]; 2750. AVStream *st = s->streams[i]; 2751. avcodec_copy_context(fst->codec, st->codec); ^ 2752. } 2753. libavcodec/options.c:477:1: Parameter `*src` 475. } 476. 477. int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) ^ 478. { 479. if (dest->codec) { // check that the dest context is uninitialized ffserver.c:2754:13: Call 2752. } 2753. 2754. av_close_input_stream(s); ^ 2755. av_free(pb); 2756. } libavformat/utils.c:2439:1: <LHS trace> 2437. } 2438. 2439. void av_close_input_stream(AVFormatContext *s) ^ 2440. { 2441. int i; libavformat/utils.c:2439:1: Parameter `s->nb_programs` 2437. } 2438. 2439. void av_close_input_stream(AVFormatContext *s) ^ 2440. { 2441. int i; libavformat/utils.c:2463:9: Binary operation: ([0, 1] - 1):unsigned32 by call to `av_close_input_stream` 2461. av_free(st); 2462. } 2463. for(i=s->nb_programs-1; i>=0; i--) { ^ 2464. #if LIBAVFORMAT_VERSION_INT < (53<<16) 2465. av_freep(&s->programs[i]->provider_name);
https://github.com/libav/libav/blob/5634f30c4a25c17c1de26703948efeafb733413d/libavformat/utils.c/#L2463
d2a_code_trace_data_45018
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:2273: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `test_ctx_set_ct_flag`. Showing all 17 steps of the trace test/bntest.c:2273:14: Call 2271. for (i = 0; i < 2; i++) { 2272. BN_CTX *c = i == 0 ? nctx : sctx; 2273. if (!TEST_true(test_ctx_set_ct_flag(c)) ^ 2274. || !TEST_true(test_ctx_check_ct_flag(c))) 2275. goto err; test/bntest.c:2199:1: Parameter `c->stack.depth` 2197. } 2198. 2199. > static int test_ctx_set_ct_flag(BN_CTX *c) 2200. { 2201. int st = 0; test/bntest.c:2205:5: Call 2203. BIGNUM *b[15]; 2204. 2205. BN_CTX_start(c); ^ 2206. for (i = 0; i < OSSL_NELEM(b); i++) { 2207. if (!TEST_ptr(b[i] = BN_CTX_get(c))) 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/bntest.c:2215:5: Call 2213. st = 1; 2214. err: 2215. BN_CTX_end(c); ^ 2216. return st; 2217. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); test/bntest.c:2273:14: Call 2271. for (i = 0; i < 2; i++) { 2272. BN_CTX *c = i == 0 ? nctx : sctx; 2273. if (!TEST_true(test_ctx_set_ct_flag(c)) ^ 2274. || !TEST_true(test_ctx_check_ct_flag(c))) 2275. goto err; test/bntest.c:2205:5: Call 2203. BIGNUM *b[15]; 2204. 2205. BN_CTX_start(c); ^ 2206. for (i = 0; i < OSSL_NELEM(b); i++) { 2207. if (!TEST_ptr(b[i] = BN_CTX_get(c))) 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/bntest.c:2215:5: Call 2213. st = 1; 2214. err: 2215. BN_CTX_end(c); ^ 2216. return st; 2217. } 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 `test_ctx_set_ct_flag` 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_45019
void avformat_free_context(AVFormatContext *s) { int i, j; AVStream *st; if (!s) return; av_opt_free(s); if (s->iformat && s->iformat->priv_class && s->priv_data) av_opt_free(s->priv_data); for (i = 0; i < s->nb_streams; i++) { st = s->streams[i]; for (j = 0; j < st->nb_side_data; j++) av_freep(&st->side_data[j].data); av_freep(&st->side_data); st->nb_side_data = 0; if (st->parser) { av_parser_close(st->parser); } if (st->attached_pic.data) av_free_packet(&st->attached_pic); av_dict_free(&st->metadata); av_freep(&st->probe_data.buf); av_free(st->index_entries); av_free(st->codec->extradata); av_free(st->codec->subtitle_header); av_free(st->codec); av_free(st->priv_data); av_free(st->info); av_free(st); } for (i = s->nb_programs - 1; i >= 0; i--) { av_dict_free(&s->programs[i]->metadata); av_freep(&s->programs[i]->stream_index); av_freep(&s->programs[i]); } av_freep(&s->programs); av_freep(&s->priv_data); while (s->nb_chapters--) { av_dict_free(&s->chapters[s->nb_chapters]->metadata); av_free(s->chapters[s->nb_chapters]); } av_freep(&s->chapters); av_dict_free(&s->metadata); av_freep(&s->streams); av_freep(&s->internal); av_free(s); } libavformat/segment.c:372: error: Integer Overflow L1 ([-oo, 0] - 1):unsigned32 by call to `avformat_free_context`. libavformat/segment.c:352:20: Call 350. 351. if (!seg->write_header_trailer) { 352. if ((ret = segment_end(oc, 0)) < 0) ^ 353. goto fail; 354. if ((ret = open_null_ctx(&oc->pb)) < 0) libavformat/segment.c:165:9: Call 163. av_write_frame(oc, NULL); /* Flush any buffered data (fragmented mp4) */ 164. if (write_trailer) 165. av_write_trailer(oc); ^ 166. avio_close(oc->pb); 167. libavformat/mux.c:634:9: Call 632. fail: 633. for (i = 0; i < s->nb_streams; i++) { 634. av_freep(&s->streams[i]->priv_data); ^ 635. av_freep(&s->streams[i]->index_entries); 636. } libavutil/mem.c:207:26: Assignment 205. 206. memcpy(&val, arg, sizeof(val)); 207. memcpy(arg, &(void *){ NULL }, sizeof(val)); ^ 208. av_free(val); 209. } libavformat/segment.c:371:5: Call 369. 370. fail: 371. avio_close(seg->pb); ^ 372. avformat_free_context(oc); 373. return ret; libavformat/aviobuf.c:816:1: Parameter `s->opaque->is_connected` 814. } 815. 816. int avio_close(AVIOContext *s) ^ 817. { 818. URLContext *h; libavformat/segment.c:372:5: Call 370. fail: 371. avio_close(seg->pb); 372. avformat_free_context(oc); ^ 373. return ret; 374. } libavformat/utils.c:2433:1: <LHS trace> 2431. } 2432. 2433. void avformat_free_context(AVFormatContext *s) ^ 2434. { 2435. int i, j; libavformat/utils.c:2433:1: Parameter `s->nb_chapters` 2431. } 2432. 2433. void avformat_free_context(AVFormatContext *s) ^ 2434. { 2435. int i, j; libavformat/utils.c:2476:12: Binary operation: ([-oo, 0] - 1):unsigned32 by call to `avformat_free_context` 2474. av_freep(&s->programs); 2475. av_freep(&s->priv_data); 2476. while (s->nb_chapters--) { ^ 2477. av_dict_free(&s->chapters[s->nb_chapters]->metadata); 2478. av_free(s->chapters[s->nb_chapters]);
https://github.com/libav/libav/blob/a7ac1a7b94447f33ae95be4d6d186e2775977f91/libavformat/utils.c/#L2476
d2a_code_trace_data_45020
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:5681: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 17 steps of the trace test/sslapitest.c:5672:10: Call 5670. SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, 5671. verify_cb); 5672. if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, ^ 5673. NULL, NULL)) 5674. || !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:5681:5: Call 5679. 5680. end: 5681. SSL_free(serverssl); ^ 5682. SSL_free(clientssl); 5683. 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:1205:5: Call 1203. RECORD_LAYER_release(&s->rlayer); 1204. 1205. SSL_CTX_free(s->ctx); ^ 1206. 1207. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:3074:1: Parameter `a->sessions->num_nodes` 3072. } 3073. 3074. > void SSL_CTX_free(SSL_CTX *a) 3075. { 3076. int i; ssl/ssl_lib.c:3100:9: Call 3098. */ 3099. if (a->sessions != NULL) 3100. SSL_CTX_flush_sessions(a, 0); ^ 3101. 3102. 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/6e46c065b9b97212d63ef1f321b08fb7fa6b320d/crypto/lhash/lhash.c/#L191
d2a_code_trace_data_45021
static void mc_block(Plane *p, uint8_t *dst, const uint8_t *src, uint8_t *tmp, int stride, int b_w, int b_h, int dx, int dy){ const static uint8_t weight[64]={ 8,7,6,5,4,3,2,1, 7,7,0,0,0,0,0,1, 6,0,6,0,0,0,2,0, 5,0,0,5,0,3,0,0, 4,0,0,0,4,0,0,0, 3,0,0,5,0,3,0,0, 2,0,6,0,0,0,2,0, 1,7,0,0,0,0,0,1, }; const static uint8_t brane[256]={ 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12, 0x04,0x05,0xcc,0xcc,0xcc,0xcc,0xcc,0x41,0x15,0x16,0xcc,0xcc,0xcc,0xcc,0xcc,0x52, 0x04,0xcc,0x05,0xcc,0xcc,0xcc,0x41,0xcc,0x15,0xcc,0x16,0xcc,0xcc,0xcc,0x52,0xcc, 0x04,0xcc,0xcc,0x05,0xcc,0x41,0xcc,0xcc,0x15,0xcc,0xcc,0x16,0xcc,0x52,0xcc,0xcc, 0x04,0xcc,0xcc,0xcc,0x41,0xcc,0xcc,0xcc,0x15,0xcc,0xcc,0xcc,0x16,0xcc,0xcc,0xcc, 0x04,0xcc,0xcc,0x41,0xcc,0x05,0xcc,0xcc,0x15,0xcc,0xcc,0x52,0xcc,0x16,0xcc,0xcc, 0x04,0xcc,0x41,0xcc,0xcc,0xcc,0x05,0xcc,0x15,0xcc,0x52,0xcc,0xcc,0xcc,0x16,0xcc, 0x04,0x41,0xcc,0xcc,0xcc,0xcc,0xcc,0x05,0x15,0x52,0xcc,0xcc,0xcc,0xcc,0xcc,0x16, 0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x55,0x56,0x56,0x56,0x56,0x56,0x56,0x56, 0x48,0x49,0xcc,0xcc,0xcc,0xcc,0xcc,0x85,0x59,0x5A,0xcc,0xcc,0xcc,0xcc,0xcc,0x96, 0x48,0xcc,0x49,0xcc,0xcc,0xcc,0x85,0xcc,0x59,0xcc,0x5A,0xcc,0xcc,0xcc,0x96,0xcc, 0x48,0xcc,0xcc,0x49,0xcc,0x85,0xcc,0xcc,0x59,0xcc,0xcc,0x5A,0xcc,0x96,0xcc,0xcc, 0x48,0xcc,0xcc,0xcc,0x49,0xcc,0xcc,0xcc,0x59,0xcc,0xcc,0xcc,0x96,0xcc,0xcc,0xcc, 0x48,0xcc,0xcc,0x85,0xcc,0x49,0xcc,0xcc,0x59,0xcc,0xcc,0x96,0xcc,0x5A,0xcc,0xcc, 0x48,0xcc,0x85,0xcc,0xcc,0xcc,0x49,0xcc,0x59,0xcc,0x96,0xcc,0xcc,0xcc,0x5A,0xcc, 0x48,0x85,0xcc,0xcc,0xcc,0xcc,0xcc,0x49,0x59,0x96,0xcc,0xcc,0xcc,0xcc,0xcc,0x5A, }; const static uint8_t needs[16]={ 0,1,0,0, 2,4,2,0, 0,1,0,0, 15 }; int x, y, b, r, l; int16_t tmpIt [64*(32+HTAPS_MAX)]; uint8_t tmp2t[3][stride*(32+HTAPS_MAX)]; int16_t *tmpI= tmpIt; uint8_t *tmp2= tmp2t[0]; const uint8_t *hpel[11]; assert(dx<16 && dy<16); r= brane[dx + 16*dy]&15; l= brane[dx + 16*dy]>>4; b= needs[l] | needs[r]; if(p && !p->diag_mc) b= 15; if(b&5){ for(y=0; y < b_h+HTAPS_MAX-1; y++){ for(x=0; x < b_w; x++){ int a_1=src[x + HTAPS_MAX/2-4]; int a0= src[x + HTAPS_MAX/2-3]; int a1= src[x + HTAPS_MAX/2-2]; int a2= src[x + HTAPS_MAX/2-1]; int a3= src[x + HTAPS_MAX/2+0]; int a4= src[x + HTAPS_MAX/2+1]; int a5= src[x + HTAPS_MAX/2+2]; int a6= src[x + HTAPS_MAX/2+3]; int am=0; if(!p || p->fast_mc){ am= 20*(a2+a3) - 5*(a1+a4) + (a0+a5); tmpI[x]= am; am= (am+16)>>5; }else{ am= p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) + p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6); tmpI[x]= am; am= (am+32)>>6; } if(am&(~255)) am= ~(am>>31); tmp2[x]= am; } tmpI+= 64; tmp2+= stride; src += stride; } src -= stride*y; } src += HTAPS_MAX/2 - 1; tmp2= tmp2t[1]; if(b&2){ for(y=0; y < b_h; y++){ for(x=0; x < b_w+1; x++){ int a_1=src[x + (HTAPS_MAX/2-4)*stride]; int a0= src[x + (HTAPS_MAX/2-3)*stride]; int a1= src[x + (HTAPS_MAX/2-2)*stride]; int a2= src[x + (HTAPS_MAX/2-1)*stride]; int a3= src[x + (HTAPS_MAX/2+0)*stride]; int a4= src[x + (HTAPS_MAX/2+1)*stride]; int a5= src[x + (HTAPS_MAX/2+2)*stride]; int a6= src[x + (HTAPS_MAX/2+3)*stride]; int am=0; if(!p || p->fast_mc) am= (20*(a2+a3) - 5*(a1+a4) + (a0+a5) + 16)>>5; else am= (p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) + p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6) + 32)>>6; if(am&(~255)) am= ~(am>>31); tmp2[x]= am; } src += stride; tmp2+= stride; } src -= stride*y; } src += stride*(HTAPS_MAX/2 - 1); tmp2= tmp2t[2]; tmpI= tmpIt; if(b&4){ for(y=0; y < b_h; y++){ for(x=0; x < b_w; x++){ int a_1=tmpI[x + (HTAPS_MAX/2-4)*64]; int a0= tmpI[x + (HTAPS_MAX/2-3)*64]; int a1= tmpI[x + (HTAPS_MAX/2-2)*64]; int a2= tmpI[x + (HTAPS_MAX/2-1)*64]; int a3= tmpI[x + (HTAPS_MAX/2+0)*64]; int a4= tmpI[x + (HTAPS_MAX/2+1)*64]; int a5= tmpI[x + (HTAPS_MAX/2+2)*64]; int a6= tmpI[x + (HTAPS_MAX/2+3)*64]; int am=0; if(!p || p->fast_mc) am= (20*(a2+a3) - 5*(a1+a4) + (a0+a5) + 512)>>10; else am= (p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) + p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6) + 2048)>>12; if(am&(~255)) am= ~(am>>31); tmp2[x]= am; } tmpI+= 64; tmp2+= stride; } } hpel[ 0]= src; hpel[ 1]= tmp2t[0] + stride*(HTAPS_MAX/2-1); hpel[ 2]= src + 1; hpel[ 4]= tmp2t[1]; hpel[ 5]= tmp2t[2]; hpel[ 6]= tmp2t[1] + 1; hpel[ 8]= src + stride; hpel[ 9]= hpel[1] + stride; hpel[10]= hpel[8] + 1; if(b==15){ const uint8_t *src1= hpel[dx/8 + dy/8*4 ]; const uint8_t *src2= hpel[dx/8 + dy/8*4+1]; const uint8_t *src3= hpel[dx/8 + dy/8*4+4]; const uint8_t *src4= hpel[dx/8 + dy/8*4+5]; dx&=7; dy&=7; for(y=0; y < b_h; y++){ for(x=0; x < b_w; x++){ dst[x]= ((8-dx)*(8-dy)*src1[x] + dx*(8-dy)*src2[x]+ (8-dx)* dy *src3[x] + dx* dy *src4[x]+32)>>6; } src1+=stride; src2+=stride; src3+=stride; src4+=stride; dst +=stride; } }else{ const uint8_t *src1= hpel[l]; const uint8_t *src2= hpel[r]; int a= weight[((dx&7) + (8*(dy&7)))]; int b= 8-a; for(y=0; y < b_h; y++){ for(x=0; x < b_w; x++){ dst[x]= (a*src1[x] + b*src2[x] + 4)>>3; } src1+=stride; src2+=stride; dst +=stride; } } } libavcodec/snow.c:2272: error: Buffer Overrun L2 Offset: [0, 15] Size: 11. libavcodec/snow.c:2114:37: <Offset trace> 2112. }; 2113. 2114. const static uint8_t brane[256]={ ^ 2115. 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12, 2116. 0x04,0x05,0xcc,0xcc,0xcc,0xcc,0xcc,0x41,0x15,0x16,0xcc,0xcc,0xcc,0xcc,0xcc,0x52, libavcodec/snow.c:2114:37: Assignment 2112. }; 2113. 2114. const static uint8_t brane[256]={ ^ 2115. 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12, 2116. 0x04,0x05,0xcc,0xcc,0xcc,0xcc,0xcc,0x41,0x15,0x16,0xcc,0xcc,0xcc,0xcc,0xcc,0x52, libavcodec/snow.c:2147:5: Assignment 2145. const uint8_t *hpel[11]; 2146. assert(dx<16 && dy<16); 2147. r= brane[dx + 16*dy]&15; ^ 2148. l= brane[dx + 16*dy]>>4; 2149. libavcodec/snow.c:2102:1: <Length trace> 2100. } 2101. 2102. static void mc_block(Plane *p, uint8_t *dst, const uint8_t *src, uint8_t *tmp, int stride, int b_w, int b_h, int dx, int dy){ ^ 2103. const static uint8_t weight[64]={ 2104. 8,7,6,5,4,3,2,1, libavcodec/snow.c:2102:1: Array declaration 2100. } 2101. 2102. static void mc_block(Plane *p, uint8_t *dst, const uint8_t *src, uint8_t *tmp, int stride, int b_w, int b_h, int dx, int dy){ ^ 2103. const static uint8_t weight[64]={ 2104. 8,7,6,5,4,3,2,1, libavcodec/snow.c:2272:30: Array access: Offset: [0, 15] Size: 11 2270. }else{ 2271. const uint8_t *src1= hpel[l]; 2272. const uint8_t *src2= hpel[r]; ^ 2273. int a= weight[((dx&7) + (8*(dy&7)))]; 2274. int b= 8-a;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/snow.c/#L2272
d2a_code_trace_data_45022
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/s_server.c:2639: error: BUFFER_OVERRUN_L2 Offset: [-oo, 1048576] Size: 8192 by call to `X509_NAME_oneline`. Showing all 8 steps of the trace apps/s_server.c:2536:1: Array declaration 2534. } 2535. 2536. > static int init_ssl_connection(SSL *con) 2537. { 2538. int i; apps/s_server.c:2639:9: Call 2637. BIO_printf(bio_s_out, "Client certificate\n"); 2638. PEM_write_bio_X509(bio_s_out, peer); 2639. X509_NAME_oneline(X509_get_subject_name(peer), buf, sizeof buf); ^ 2640. BIO_printf(bio_s_out, "subject=%s\n", buf); 2641. X509_NAME_oneline(X509_get_issuer_name(peer), buf, sizeof 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: 8192 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_45023
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) { int line_size; int sample_size = av_get_bytes_per_sample(sample_fmt); int planar = av_sample_fmt_is_planar(sample_fmt); if (!sample_size || nb_samples <= 0 || nb_channels <= 0) return AVERROR(EINVAL); if (!align) { if (nb_samples > INT_MAX - 31) return AVERROR(EINVAL); align = 1; nb_samples = FFALIGN(nb_samples, 32); } if (nb_channels > INT_MAX / align || (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size) return AVERROR(EINVAL); line_size = planar ? FFALIGN(nb_samples * sample_size, align) : FFALIGN(nb_samples * sample_size * nb_channels, align); if (linesize) *linesize = line_size; return planar ? line_size * nb_channels : line_size; } libavcodec/mjpegdec.c:1581: error: Integer Overflow L2 ([1, 2147483616] + 32):signed32 by call to `av_frame_ref`. libavcodec/mjpegdec.c:1474:22: Call 1472. while (buf_ptr < buf_end) { 1473. /* find start next marker */ 1474. start_code = ff_mjpeg_find_marker(s, &buf_ptr, buf_end, ^ 1475. &unescaped_buf_ptr, 1476. &unescaped_buf_size); libavcodec/mjpegdec.c:1368:1: Parameter `s->avctx->codec_id` 1366. } 1367. 1368. int ff_mjpeg_find_marker(MJpegDecodeContext *s, ^ 1369. const uint8_t **buf_ptr, const uint8_t *buf_end, 1370. const uint8_t **unescaped_buf_ptr, libavcodec/mjpegdec.c:1581:24: Call 1579. goto not_the_end; 1580. } 1581. if ((ret = av_frame_ref(frame, s->picture_ptr)) < 0) ^ 1582. return ret; 1583. if (s->flipped) { libavutil/frame.c:174:1: Parameter `src->nb_samples` 172. } 173. 174. int av_frame_ref(AVFrame *dst, const AVFrame *src) ^ 175. { 176. int i, ret = 0; libavutil/frame.c:182:5: Assignment 180. dst->height = src->height; 181. dst->channel_layout = src->channel_layout; 182. dst->nb_samples = src->nb_samples; ^ 183. 184. ret = av_frame_copy_props(dst, src); libavutil/frame.c:190:15: Call 188. /* duplicate the frame data if it's not refcounted */ 189. if (!src->buf[0]) { 190. ret = av_frame_get_buffer(dst, 32); ^ 191. if (ret < 0) 192. return ret; libavutil/frame.c:161:1: Parameter `frame->nb_samples` 159. } 160. 161. int av_frame_get_buffer(AVFrame *frame, int align) ^ 162. { 163. if (frame->format < 0) libavutil/frame.c:169:16: Call 167. return get_video_buffer(frame, align); 168. else if (frame->nb_samples > 0 && frame->channel_layout) 169. return get_audio_buffer(frame, align); ^ 170. 171. return AVERROR(EINVAL); libavutil/frame.c:112:1: Parameter `frame->nb_samples` 110. } 111. 112. static int get_audio_buffer(AVFrame *frame, int align) ^ 113. { 114. int channels = av_get_channel_layout_nb_channels(frame->channel_layout); libavutil/frame.c:120:15: Call 118. 119. if (!frame->linesize[0]) { 120. ret = av_samples_get_buffer_size(&frame->linesize[0], channels, ^ 121. frame->nb_samples, frame->format, 122. align); libavutil/samplefmt.c:108:1: <LHS trace> 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:108:1: Parameter `nb_samples` 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:124:9: Binary operation: ([1, 2147483616] + 32):signed32 by call to `av_frame_ref` 122. return AVERROR(EINVAL); 123. align = 1; 124. nb_samples = FFALIGN(nb_samples, 32); ^ 125. } 126.
https://github.com/libav/libav/blob/0e830094ad0dc251613a0aa3234d9c5c397e02e6/libavutil/samplefmt.c/#L124
d2a_code_trace_data_45024
void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) { #ifdef POLY1305_ASM poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks; #endif size_t rem, num; if ((num = ctx->num)) { rem = POLY1305_BLOCK_SIZE - num; if (len >= rem) { memcpy(ctx->data + num, inp, rem); poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1); inp += rem; len -= rem; } else { memcpy(ctx->data + num, inp, len); ctx->num = num + len; return; } } rem = len % POLY1305_BLOCK_SIZE; len -= rem; if (len >= POLY1305_BLOCK_SIZE) { poly1305_blocks(ctx->opaque, inp, len, 1); inp += len; } if (rem) memcpy(ctx->data, inp, rem); ctx->num = rem; } crypto/evp/e_chacha20_poly1305.c:274: error: INTEGER_OVERFLOW_L2 ([-15, +oo] - [-15, 15]):unsigned64 by call to `Poly1305_Update`. Showing all 8 steps of the trace crypto/evp/e_chacha20_poly1305.c:233:1: Parameter `len` 231. } 232. 233. > static int chacha20_poly1305_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 234. const unsigned char *in, size_t len) 235. { crypto/evp/e_chacha20_poly1305.c:274:17: Call 272. if (ctx->encrypt) { /* plaintext */ 273. chacha_cipher(ctx, out, in, plen); 274. Poly1305_Update(POLY1305_ctx(actx), out, plen); ^ 275. in += plen; 276. out += plen; crypto/poly1305/poly1305.c:466:1: <LHS trace> 464. #endif 465. 466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 467. { 468. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:466:1: Parameter `len` 464. #endif 465. 466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 467. { 468. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:466:1: <RHS trace> 464. #endif 465. 466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 467. { 468. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:466:1: Parameter `len` 464. #endif 465. 466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 467. { 468. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:494:5: Assignment 492. } 493. 494. rem = len % POLY1305_BLOCK_SIZE; ^ 495. len -= rem; 496. crypto/poly1305/poly1305.c:495:5: Binary operation: ([-15, +oo] - [-15, 15]):unsigned64 by call to `Poly1305_Update` 493. 494. rem = len % POLY1305_BLOCK_SIZE; 495. len -= rem; ^ 496. 497. if (len >= POLY1305_BLOCK_SIZE) {
https://github.com/openssl/openssl/blob/740b2b9a6cf31b02916a4d18f868e8a95934c083/crypto/poly1305/poly1305.c/#L495
d2a_code_trace_data_45025
int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, const char *dir) { DIR *d; struct dirent *dstruct; int ret = 0; CRYPTO_w_lock(CRYPTO_LOCK_READDIR); d = opendir(dir); if(!d) { SYSerr(SYS_F_OPENDIR, get_last_sys_error()); ERR_add_error_data(3, "opendir('", dir, "')"); SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB); goto err; } while((dstruct=readdir(d))) { char buf[1024]; int r; if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf) { SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG); goto err; } r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name); if (r <= 0 || r >= sizeof buf) goto err; if(!SSL_add_file_cert_subjects_to_stack(stack,buf)) goto err; } ret = 1; err: CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); return ret; } ssl/ssl_cert.c:763: error: RESOURCE_LEAK resource acquired by call to `opendir()` at line 745, column 6 is not released after line 763, column 4. Showing all 24 steps of the trace ssl/ssl_cert.c:737:1: start of procedure SSL_add_dir_cert_subjects_to_stack() 735. #ifndef OPENSSL_SYS_MACINTOSH_CLASSIC /* XXXXX: Better scheme needed! */ 736. 737. > int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, 738. const char *dir) 739. { ssl/ssl_cert.c:742:2: 740. DIR *d; 741. struct dirent *dstruct; 742. > int ret = 0; 743. 744. CRYPTO_w_lock(CRYPTO_LOCK_READDIR); ssl/ssl_cert.c:744:2: 742. int ret = 0; 743. 744. > CRYPTO_w_lock(CRYPTO_LOCK_READDIR); 745. d = opendir(dir); 746. crypto/cryptlib.c:379:1: start of procedure CRYPTO_lock() 377. } 378. 379. > void CRYPTO_lock(int mode, int type, const char *file, int line) 380. { 381. #ifdef LOCK_DEBUG crypto/cryptlib.c:404:6: Taking false branch 402. } 403. #endif 404. if (type < 0) ^ 405. { 406. struct CRYPTO_dynlock_value *pointer crypto/cryptlib.c:417:7: Taking true branch 415. } 416. else 417. if (locking_callback != NULL) ^ 418. locking_callback(mode,type,file,line); 419. } crypto/cryptlib.c:418:4: Skipping __function_pointer__(): unresolved function pointer 416. else 417. if (locking_callback != NULL) 418. locking_callback(mode,type,file,line); ^ 419. } 420. crypto/cryptlib.c:404:2: 402. } 403. #endif 404. > if (type < 0) 405. { 406. struct CRYPTO_dynlock_value *pointer crypto/cryptlib.c:419:2: return from a call to CRYPTO_lock 417. if (locking_callback != NULL) 418. locking_callback(mode,type,file,line); 419. } ^ 420. 421. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, ssl/ssl_cert.c:745:2: 743. 744. CRYPTO_w_lock(CRYPTO_LOCK_READDIR); 745. > d = opendir(dir); 746. 747. /* Note that a side effect is that the CAs will be sorted by name */ ssl/ssl_cert.c:748:6: Taking false branch 746. 747. /* Note that a side effect is that the CAs will be sorted by name */ 748. if(!d) ^ 749. { 750. SYSerr(SYS_F_OPENDIR, get_last_sys_error()); ssl/ssl_cert.c:756:9: Loop condition is true. Entering loop body 754. } 755. 756. while((dstruct=readdir(d))) ^ 757. { 758. char buf[1024]; ssl/ssl_cert.c:761:6: Taking true branch 759. int r; 760. 761. if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf) ^ 762. { 763. SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG); ssl/ssl_cert.c:763:4: 761. if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf) 762. { 763. > SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG); 764. goto err; 765. } crypto/err/err.c:615:1: start of procedure ERR_put_error() 613. /********************************************************/ 614. 615. > void ERR_put_error(int lib, int func, int reason, const char *file, 616. int line) 617. { crypto/err/err.c:639:2: Skipping ERR_get_state(): empty list of specs 637. } 638. #endif 639. es=ERR_get_state(); ^ 640. 641. es->top=(es->top+1)%ERR_NUM_ERRORS; crypto/err/err.c:641:2: 639. es=ERR_get_state(); 640. 641. > es->top=(es->top+1)%ERR_NUM_ERRORS; 642. if (es->top == es->bottom) 643. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; crypto/err/err.c:642:6: Taking false branch 640. 641. es->top=(es->top+1)%ERR_NUM_ERRORS; 642. if (es->top == es->bottom) ^ 643. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; 644. es->err_buffer[es->top]=ERR_PACK(lib,func,reason); crypto/err/err.c:644:2: 642. if (es->top == es->bottom) 643. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; 644. > es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 645. es->err_file[es->top]=file; 646. es->err_line[es->top]=line; crypto/err/err.c:645:2: 643. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; 644. es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 645. > es->err_file[es->top]=file; 646. es->err_line[es->top]=line; 647. err_clear_data(es,es->top); crypto/err/err.c:646:2: 644. es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 645. es->err_file[es->top]=file; 646. > es->err_line[es->top]=line; 647. err_clear_data(es,es->top); 648. } crypto/err/err.c:647:2: Taking true branch 645. es->err_file[es->top]=file; 646. es->err_line[es->top]=line; 647. err_clear_data(es,es->top); ^ 648. } 649. crypto/err/err.c:647:2: Taking false branch 645. es->err_file[es->top]=file; 646. es->err_line[es->top]=line; 647. err_clear_data(es,es->top); ^ 648. } 649. crypto/err/err.c:648:2: return from a call to ERR_put_error 646. es->err_line[es->top]=line; 647. err_clear_data(es,es->top); 648. } ^ 649. 650. void ERR_clear_error(void)
https://github.com/openssl/openssl/blob/4bf4bc784f12bcdc3a3e772f85f6d33f5eccdab3/ssl/ssl_cert.c/#L763
d2a_code_trace_data_45026
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:1343: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit`. libavcodec/alsdec.c:1327:1: Parameter `ctx->bc.bits_left` 1325. /** Read the frame data. 1326. */ 1327. static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame) ^ 1328. { 1329. ALSSpecificConfig *sconf = &ctx->sconf; libavcodec/alsdec.c:1343:26: Call 1341. 1342. if (sconf->mc_coding && sconf->joint_stereo) { 1343. ctx->js_switch = bitstream_read_bit(bc); ^ 1344. bitstream_align(bc); 1345. } 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 `bitstream_read_bit` 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_45027
ngx_int_t ngx_http_internal_redirect(ngx_http_request_t *r, ngx_str_t *uri, ngx_str_t *args) { ngx_http_core_srv_conf_t *cscf; r->uri_changes--; if (r->uri_changes == 0) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "rewrite or internal redirection cycle " "while internally redirecting to \"%V\"", uri); r->main->count++; ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); return NGX_DONE; } r->uri = *uri; if (args) { r->args = *args; } else { ngx_str_null(&r->args); } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "internal redirect: \"%V?%V\"", uri, &r->args); ngx_http_set_exten(r); ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module); cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); r->loc_conf = cscf->ctx->loc_conf; ngx_http_update_location_config(r); #if (NGX_HTTP_CACHE) r->cache = NULL; #endif r->internal = 1; r->valid_unparsed_uri = 0; r->add_uri_to_alias = 0; r->main->count++; ngx_http_handler(r); return NGX_DONE; } src/http/ngx_http_upstream.c:1709: error: Integer Overflow L2 ([0, `r->uri_changes`] - 1):unsigned32 by call to `ngx_http_upstream_process_body_in_memory`. src/http/ngx_http_upstream.c:1527:1: Parameter `r->uri_changes` 1525. 1526. 1527. static void ^ 1528. ngx_http_upstream_process_header(ngx_http_request_t *r, ngx_http_upstream_t *u) 1529. { src/http/ngx_http_upstream.c:1667:9: Call 1665. } 1666. 1667. if (ngx_http_upstream_process_headers(r, u) != NGX_OK) { ^ 1668. return; 1669. } src/http/ngx_http_upstream.c:1881:1: Parameter `r->uri_changes` 1879. 1880. 1881. static ngx_int_t ^ 1882. ngx_http_upstream_process_headers(ngx_http_request_t *r, ngx_http_upstream_t *u) 1883. { src/http/ngx_http_upstream.c:1709:5: Call 1707. u->read_event_handler = ngx_http_upstream_process_body_in_memory; 1708. 1709. ngx_http_upstream_process_body_in_memory(r, u); ^ 1710. } 1711. src/http/ngx_http_upstream.c:2003:1: Parameter `r->uri_changes` 2001. 2002. 2003. static void ^ 2004. ngx_http_upstream_process_body_in_memory(ngx_http_request_t *r, 2005. ngx_http_upstream_t *u) src/http/ngx_http_upstream.c:2021:9: Call 2019. if (rev->timedout) { 2020. ngx_connection_error(c, NGX_ETIMEDOUT, "upstream timed out"); 2021. ngx_http_upstream_finalize_request(r, u, NGX_HTTP_GATEWAY_TIME_OUT); ^ 2022. return; 2023. } src/http/ngx_http_upstream.c:3269:1: Parameter `r->uri_changes` 3267. 3268. 3269. static void ^ 3270. ngx_http_upstream_finalize_request(ngx_http_request_t *r, 3271. ngx_http_upstream_t *u, ngx_int_t rc) src/http/ngx_http_upstream.c:3402:5: Call 3400. } 3401. 3402. ngx_http_finalize_request(r, rc); ^ 3403. } 3404. src/http/ngx_http_request.c:2198:1: Parameter `r->uri_changes` 2196. 2197. 2198. void ^ 2199. ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) 2200. { src/http/ngx_http_request.c:2236:13: Call 2234. || c->error) 2235. { 2236. if (ngx_http_post_action(r) == NGX_OK) { ^ 2237. return; 2238. } src/http/ngx_http_request.c:3256:1: Parameter `r->uri_changes` 3254. 3255. 3256. static ngx_int_t ^ 3257. ngx_http_post_action(ngx_http_request_t *r) 3258. { src/http/ngx_http_request.c:3283:9: Call 3281. 3282. if (clcf->post_action.data[0] == '/') { 3283. ngx_http_internal_redirect(r, &clcf->post_action, NULL); ^ 3284. 3285. } else { src/http/ngx_http_core_module.c:2551:1: <LHS trace> 2549. 2550. 2551. ngx_int_t ^ 2552. ngx_http_internal_redirect(ngx_http_request_t *r, 2553. ngx_str_t *uri, ngx_str_t *args) src/http/ngx_http_core_module.c:2551:1: Parameter `r->uri_changes` 2549. 2550. 2551. ngx_int_t ^ 2552. ngx_http_internal_redirect(ngx_http_request_t *r, 2553. ngx_str_t *uri, ngx_str_t *args) src/http/ngx_http_core_module.c:2557:5: Binary operation: ([0, r->uri_changes] - 1):unsigned32 by call to `ngx_http_upstream_process_body_in_memory` 2555. ngx_http_core_srv_conf_t *cscf; 2556. 2557. r->uri_changes--; ^ 2558. 2559. if (r->uri_changes == 0) {
https://github.com/nginx/nginx/blob/416b922bd2c285551d195c1f33a3736775ea45e9/src/http/ngx_http_core_module.c/#L2557
d2a_code_trace_data_45028
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_opt.c:1656: error: Null Dereference pointer `today` last assigned on line 1654 could be null and is dereferenced at line 1656, column 69. avconv_opt.c:1650:1: start of procedure opt_vstats() 1648. } 1649. 1650. static int opt_vstats(const char *opt, const char *arg) ^ 1651. { 1652. char filename[40]; avconv_opt.c:1653:5: 1651. { 1652. char filename[40]; 1653. time_t today2 = time(NULL); ^ 1654. struct tm *today = localtime(&today2); 1655. avconv_opt.c:1654:5: 1652. char filename[40]; 1653. time_t today2 = time(NULL); 1654. struct tm *today = localtime(&today2); ^ 1655. 1656. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, avconv_opt.c:1656:5: 1654. struct tm *today = localtime(&today2); 1655. 1656. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, ^ 1657. today->tm_sec); 1658. return opt_vstats_file(opt, filename);
https://github.com/libav/libav/blob/1ce5dce454ea46280b188f0b7e37fc976fcfb606/avconv_opt.c/#L1656
d2a_code_trace_data_45029
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/takdec.c:389: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit`. libavcodec/takdec.c:375:1: Parameter `size` 373. } 374. 375. static void decode_filter_coeffs(TAKDecContext *s, int filter_order, int size, ^ 376. int filter_quant, int16_t *filter) 377. { libavcodec/takdec.c:386:21: Call 384. predictors[1] = bitstream_read_signed(bc, 10); 385. predictors[2] = bitstream_read_signed(bc, size) << (10 - size); 386. predictors[3] = bitstream_read_signed(bc, size) << (10 - size); ^ 387. if (filter_order > 4) { 388. int av_uninit(code_size); libavcodec/bitstream.h:199:1: Parameter `n` 197. /* Return n bits from the buffer as a signed integer. 198. * n has to be in the 0-32 range. */ 199. static inline int32_t bitstream_read_signed(BitstreamContext *bc, unsigned n) ^ 200. { 201. return sign_extend(bitstream_read(bc, n), n); libavcodec/bitstream.h:201:24: Call 199. static inline int32_t bitstream_read_signed(BitstreamContext *bc, unsigned n) 200. { 201. return sign_extend(bitstream_read(bc, n), n); ^ 202. } 203. libavcodec/bitstream.h:183:1: Parameter `bc->bits_left` 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/takdec.c:389:37: Call 387. if (filter_order > 4) { 388. int av_uninit(code_size); 389. int code_size_base = size - bitstream_read_bit(bc); ^ 390. 391. for (i = 4; i < filter_order; i++) { 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 `bitstream_read_bit` 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_45030
IMPLEMENT_new_ctx(cfb8, CFB, 256) providers/common/ciphers/aes.c:312: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 312 could be null and is dereferenced at line 312, column 1. Showing all 18 steps of the trace providers/common/ciphers/aes.c:312:1: start of procedure aes_256_cfb8_newctx() 310. IMPLEMENT_new_ctx(cfb1, CFB, 192) 311. IMPLEMENT_new_ctx(cfb1, CFB, 128) 312. > IMPLEMENT_new_ctx(cfb8, CFB, 256) 313. IMPLEMENT_new_ctx(cfb8, CFB, 192) 314. IMPLEMENT_new_ctx(cfb8, CFB, 128) crypto/mem.c:228:1: start of procedure CRYPTO_zalloc() 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:5: 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:192:1: start of procedure CRYPTO_malloc() 190. #endif 191. 192. > void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. void *ret = NULL; crypto/mem.c:194:5: 192. void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. > void *ret = NULL; 195. 196. INCREMENT(malloc_count); crypto/mem.c:197:9: Taking false branch 195. 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 198. return malloc_impl(num, file, line); 199. crypto/mem.c:200:9: Taking false branch 198. return malloc_impl(num, file, line); 199. 200. if (num == 0) ^ 201. return NULL; 202. crypto/mem.c:204:9: Taking true branch 202. 203. FAILTEST(); 204. if (allow_customize) { ^ 205. /* 206. * Disallow customization after the first allocation. We only set this crypto/mem.c:210:9: 208. * allocation. 209. */ 210. > allow_customize = 0; 211. } 212. #if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE) crypto/mem.c:221:5: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:221:19: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:222:5: 220. #else 221. (void)(file); (void)(line); 222. > ret = malloc(num); 223. #endif 224. crypto/mem.c:225:5: 223. #endif 224. 225. > return ret; 226. } 227. crypto/mem.c:226:1: return from a call to CRYPTO_malloc 224. 225. return ret; 226. > } 227. 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:233:9: Taking false branch 231. 232. FAILTEST(); 233. if (ret != NULL) ^ 234. memset(ret, 0, num); 235. return ret; crypto/mem.c:235:5: 233. if (ret != NULL) 234. memset(ret, 0, num); 235. > return ret; 236. } 237. crypto/mem.c:236:1: return from a call to CRYPTO_zalloc 234. memset(ret, 0, num); 235. return ret; 236. > } 237. 238. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) providers/common/ciphers/aes.c:312:1: 310. IMPLEMENT_new_ctx(cfb1, CFB, 192) 311. IMPLEMENT_new_ctx(cfb1, CFB, 128) 312. > IMPLEMENT_new_ctx(cfb8, CFB, 256) 313. IMPLEMENT_new_ctx(cfb8, CFB, 192) 314. IMPLEMENT_new_ctx(cfb8, CFB, 128)
https://github.com/openssl/openssl/blob/f79858ac4d90a450d0620d1ecb713bc35d7d9f8d/providers/common/ciphers/aes.c/#L312
d2a_code_trace_data_45031
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:1174: error: Uninitialized Value The value read from xmax was never initialized. libavcodec/motion_est_template.c:1174:9: 1172. } 1173. if(dmin>64*4){ 1174. CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, ^ 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
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1174
d2a_code_trace_data_45032
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; } libavformat/mpc8.c:114: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit`. libavformat/mpc8.c:110:1: Parameter `bc->bits_left` 108. } 109. 110. static inline int64_t gb_get_v(BitstreamContext *bc) ^ 111. { 112. int64_t v = 0; libavformat/mpc8.c:114:12: Call 112. int64_t v = 0; 113. int bits = 0; 114. while (bitstream_read_bit(bc) && bits < 64 - 7) { ^ 115. v <<= 7; 116. v |= bitstream_read(bc, 7); 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 `bitstream_read_bit` 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_45033
int RAND_pseudo_bytes(unsigned char *buf, int num) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->pseudorand != NULL) return meth->pseudorand(buf, num); return -1; } crypto/rand/rand_lib.c:835: error: NULL_DEREFERENCE pointer `meth` last assigned on line 833 could be null and is dereferenced at line 835, column 9. Showing all 14 steps of the trace crypto/rand/rand_lib.c:831:1: start of procedure RAND_pseudo_bytes() 829. 830. #if !OPENSSL_API_1_1_0 831. > int RAND_pseudo_bytes(unsigned char *buf, int num) 832. { 833. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:833:5: 831. int RAND_pseudo_bytes(unsigned char *buf, int num) 832. { 833. > const RAND_METHOD *meth = RAND_get_rand_method(); 834. 835. if (meth->pseudorand != NULL) crypto/rand/rand_lib.c:726:1: start of procedure RAND_get_rand_method() 724. } 725. 726. > const RAND_METHOD *RAND_get_rand_method(void) 727. { 728. const RAND_METHOD *tmp_meth = NULL; crypto/rand/rand_lib.c:728:5: 726. const RAND_METHOD *RAND_get_rand_method(void) 727. { 728. > const RAND_METHOD *tmp_meth = NULL; 729. 730. if (!RUN_ONCE(&rand_init, do_rand_init)) crypto/rand/rand_lib.c:730:10: 728. const RAND_METHOD *tmp_meth = NULL; 729. 730. > if (!RUN_ONCE(&rand_init, do_rand_init)) 731. return NULL; 732. 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 true 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:114:9: 112. { 113. if (pthread_once(once, init) != 0) 114. > return 0; 115. 116. return 1; 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/rand/rand_lib.c:730:10: Condition is false 728. const RAND_METHOD *tmp_meth = NULL; 729. 730. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 731. return NULL; 732. crypto/rand/rand_lib.c:730:10: Taking true branch 728. const RAND_METHOD *tmp_meth = NULL; 729. 730. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 731. return NULL; 732. crypto/rand/rand_lib.c:731:9: 729. 730. if (!RUN_ONCE(&rand_init, do_rand_init)) 731. > return NULL; 732. 733. CRYPTO_THREAD_write_lock(rand_meth_lock); crypto/rand/rand_lib.c:754:1: return from a call to RAND_get_rand_method 752. CRYPTO_THREAD_unlock(rand_meth_lock); 753. return tmp_meth; 754. > } 755. 756. #ifndef OPENSSL_NO_ENGINE crypto/rand/rand_lib.c:835:9: 833. const RAND_METHOD *meth = RAND_get_rand_method(); 834. 835. > if (meth->pseudorand != NULL) 836. return meth->pseudorand(buf, num); 837. return -1;
https://github.com/openssl/openssl/blob/9bba2c4c97a5fc5aea9e24223eebb85a15817e74/crypto/rand/rand_lib.c/#L835
d2a_code_trace_data_45034
int WPACKET_allocate_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; if (pkt->buf->length > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = (pkt->buf->length == 0) ? DEFAULT_BUF_SIZE : pkt->buf->length * 2; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/statem/statem_srvr.c:848: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_sub_memcpy__`. Showing all 12 steps of the trace ssl/statem/statem_srvr.c:847:10: Call 845. { 846. /* Always use DTLS 1.0 version: see RFC 6347 */ 847. if (!WPACKET_put_bytes_u16(pkt, DTLS1_VERSION) ^ 848. || !WPACKET_sub_memcpy_u8(pkt, cookie, cookie_len)) 849. return 0; ssl/packet.c:238:1: Parameter `pkt->buf->length` 236. } 237. 238. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 239. { 240. unsigned char *data; ssl/statem/statem_srvr.c:848:17: Call 846. /* Always use DTLS 1.0 version: see RFC 6347 */ 847. if (!WPACKET_put_bytes_u16(pkt, DTLS1_VERSION) 848. || !WPACKET_sub_memcpy_u8(pkt, cookie, cookie_len)) ^ 849. return 0; 850. ssl/packet.c:294:1: Parameter `pkt->written` 292. } 293. 294. > int WPACKET_sub_memcpy__(WPACKET *pkt, const void *src, size_t len, 295. size_t lenbytes) 296. { ssl/packet.c:297:10: Call 295. size_t lenbytes) 296. { 297. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) ^ 298. || !WPACKET_memcpy(pkt, src, len) 299. || !WPACKET_close(pkt)) ssl/packet.c:201:1: Parameter `pkt->written` 199. } 200. 201. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 202. { 203. WPACKET_SUB *sub; ssl/packet.c:225:10: Call 223. } 224. 225. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 226. return 0; 227. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 4]):unsigned64 by call to `WPACKET_sub_memcpy__` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27.
https://github.com/openssl/openssl/blob/84d5549e692e63a16fa1b11603e4098fc31746e9/ssl/packet.c/#L25
d2a_code_trace_data_45035
int tls13_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 exportsecret[EVP_MAX_MD_SIZE]; static const unsigned char exporterlabel[] = "exporter"; unsigned char hash[EVP_MAX_MD_SIZE], data[EVP_MAX_MD_SIZE]; const EVP_MD *md = ssl_handshake_md(s); EVP_MD_CTX *ctx = EVP_MD_CTX_new(); unsigned int hashsize, datalen; int ret = 0; if (ctx == NULL || !ossl_statem_export_allowed(s)) goto err; if (!use_context) contextlen = 0; if (EVP_DigestInit_ex(ctx, md, NULL) <= 0 || EVP_DigestUpdate(ctx, context, contextlen) <= 0 || EVP_DigestFinal_ex(ctx, hash, &hashsize) <= 0 || EVP_DigestInit_ex(ctx, md, NULL) <= 0 || EVP_DigestFinal_ex(ctx, data, &datalen) <= 0 || !tls13_hkdf_expand(s, md, s->exporter_master_secret, (const unsigned char *)label, llen, data, datalen, exportsecret, hashsize) || !tls13_hkdf_expand(s, md, exportsecret, exporterlabel, sizeof(exporterlabel) - 1, hash, hashsize, out, olen)) goto err; ret = 1; err: EVP_MD_CTX_free(ctx); return ret; } ssl/tls13_enc.c:706: error: MEMORY_LEAK memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 681, column 23 is not reachable after line 706, column 5. Showing all 51 steps of the trace ssl/tls13_enc.c:672:1: start of procedure tls13_export_keying_material() 670. } 671. 672. > int tls13_export_keying_material(SSL *s, unsigned char *out, size_t olen, 673. const char *label, size_t llen, 674. const unsigned char *context, ssl/tls13_enc.c:678:5: 676. { 677. unsigned char exportsecret[EVP_MAX_MD_SIZE]; 678. > static const unsigned char exporterlabel[] = "exporter"; 679. unsigned char hash[EVP_MAX_MD_SIZE], data[EVP_MAX_MD_SIZE]; 680. const EVP_MD *md = ssl_handshake_md(s); ssl/tls13_enc.c:680:5: 678. static const unsigned char exporterlabel[] = "exporter"; 679. unsigned char hash[EVP_MAX_MD_SIZE], data[EVP_MAX_MD_SIZE]; 680. > const EVP_MD *md = ssl_handshake_md(s); 681. EVP_MD_CTX *ctx = EVP_MD_CTX_new(); 682. unsigned int hashsize, datalen; test/tls13secretstest.c:171:1: start of procedure ssl_handshake_md() 169. } 170. 171. > const EVP_MD *ssl_handshake_md(SSL *s) 172. { 173. return EVP_sha256(); test/tls13secretstest.c:173:5: 171. const EVP_MD *ssl_handshake_md(SSL *s) 172. { 173. > return EVP_sha256(); 174. } 175. crypto/evp/m_sha1.c:177:1: start of procedure EVP_sha256() 175. }; 176. 177. > const EVP_MD *EVP_sha256(void) 178. { 179. return &sha256_md; crypto/evp/m_sha1.c:179:5: 177. const EVP_MD *EVP_sha256(void) 178. { 179. > return &sha256_md; 180. } 181. crypto/evp/m_sha1.c:180:1: return from a call to EVP_sha256 178. { 179. return &sha256_md; 180. > } 181. 182. static int init512_224(EVP_MD_CTX *ctx) test/tls13secretstest.c:174:1: return from a call to ssl_handshake_md 172. { 173. return EVP_sha256(); 174. > } 175. 176. void RECORD_LAYER_reset_read_sequence(RECORD_LAYER *rl) ssl/tls13_enc.c:681:5: 679. unsigned char hash[EVP_MAX_MD_SIZE], data[EVP_MAX_MD_SIZE]; 680. const EVP_MD *md = ssl_handshake_md(s); 681. > EVP_MD_CTX *ctx = EVP_MD_CTX_new(); 682. unsigned int hashsize, datalen; 683. int ret = 0; 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:228:1: start of procedure CRYPTO_zalloc() 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:5: 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:192:1: start of procedure CRYPTO_malloc() 190. #endif 191. 192. > void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. void *ret = NULL; crypto/mem.c:194:5: 192. void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. > void *ret = NULL; 195. 196. INCREMENT(malloc_count); crypto/mem.c:197:9: Taking false branch 195. 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 198. return malloc_impl(num, file, line); 199. crypto/mem.c:200:9: Taking false branch 198. return malloc_impl(num, file, line); 199. 200. if (num == 0) ^ 201. return NULL; 202. crypto/mem.c:204:9: Taking true branch 202. 203. FAILTEST(); 204. if (allow_customize) { ^ 205. /* 206. * Disallow customization after the first allocation. We only set this crypto/mem.c:210:9: 208. * allocation. 209. */ 210. > allow_customize = 0; 211. } 212. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:221:5: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:221:19: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:222:5: 220. #else 221. (void)(file); (void)(line); 222. > ret = malloc(num); 223. #endif 224. crypto/mem.c:225:5: 223. #endif 224. 225. > return ret; 226. } 227. crypto/mem.c:226:1: return from a call to CRYPTO_malloc 224. 225. return ret; 226. > } 227. 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:233:9: Taking true branch 231. 232. FAILTEST(); 233. if (ret != NULL) ^ 234. memset(ret, 0, num); 235. return ret; crypto/mem.c:234:9: 232. FAILTEST(); 233. if (ret != NULL) 234. > memset(ret, 0, num); 235. return ret; 236. } crypto/mem.c:235:5: 233. if (ret != NULL) 234. memset(ret, 0, num); 235. > return ret; 236. } 237. crypto/mem.c:236:1: return from a call to CRYPTO_zalloc 234. memset(ret, 0, num); 235. return ret; 236. > } 237. 238. 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/tls13_enc.c:683:5: 681. EVP_MD_CTX *ctx = EVP_MD_CTX_new(); 682. unsigned int hashsize, datalen; 683. > int ret = 0; 684. 685. if (ctx == NULL || !ossl_statem_export_allowed(s)) ssl/tls13_enc.c:685:9: Taking false branch 683. int ret = 0; 684. 685. if (ctx == NULL || !ossl_statem_export_allowed(s)) ^ 686. goto err; 687. ssl/tls13_enc.c:685:25: 683. int ret = 0; 684. 685. > if (ctx == NULL || !ossl_statem_export_allowed(s)) 686. goto err; 687. test/tls13secretstest.c:215:1: start of procedure ossl_statem_export_allowed() 213. } 214. 215. > int ossl_statem_export_allowed(SSL *s) 216. { 217. return 1; test/tls13secretstest.c:217:5: 215. int ossl_statem_export_allowed(SSL *s) 216. { 217. > return 1; 218. } 219. test/tls13secretstest.c:218:1: return from a call to ossl_statem_export_allowed 216. { 217. return 1; 218. > } 219. 220. int ossl_statem_export_early_allowed(SSL *s) ssl/tls13_enc.c:685:25: Taking false branch 683. int ret = 0; 684. 685. if (ctx == NULL || !ossl_statem_export_allowed(s)) ^ 686. goto err; 687. ssl/tls13_enc.c:688:10: Taking false branch 686. goto err; 687. 688. if (!use_context) ^ 689. contextlen = 0; 690. ssl/tls13_enc.c:691:9: Taking true branch 689. contextlen = 0; 690. 691. if (EVP_DigestInit_ex(ctx, md, NULL) <= 0 ^ 692. || EVP_DigestUpdate(ctx, context, contextlen) <= 0 693. || EVP_DigestFinal_ex(ctx, hash, &hashsize) <= 0 ssl/tls13_enc.c:705:2: 703. 704. ret = 1; 705. > err: 706. EVP_MD_CTX_free(ctx); 707. return ret; ssl/tls13_enc.c:706:5: 704. ret = 1; 705. err: 706. > EVP_MD_CTX_free(ctx); 707. return ret; 708. } 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:295:1: start of procedure CRYPTO_free() 293. } 294. 295. > void CRYPTO_free(void *str, const char *file, int line) 296. { 297. INCREMENT(free_count); crypto/mem.c:298:9: Taking true branch 296. { 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 299. free_impl(str, file, line); 300. return; crypto/mem.c:298:30: Taking true branch 296. { 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 299. free_impl(str, file, line); 300. return; crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { 299. free_impl(str, file, line); ^ 300. return; 301. } crypto/mem.c:300:9: 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { 299. free_impl(str, file, line); 300. > return; 301. } 302. crypto/mem.c:314:1: return from a call to CRYPTO_free 312. free(str); 313. #endif 314. > } 315. 316. 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)
https://github.com/openssl/openssl/blob/f39276fdff6ccc1c71bdb30a8050fa1c0bf6e20a/ssl/tls13_enc.c/#L706
d2a_code_trace_data_45036
static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) { unsigned int ge; ge = ~((a ^ b) | (a - b)); ge |= a & ~b; return constant_time_msb(ge); } ssl/d1_pkt.c:315: error: INTEGER_OVERFLOW_L2 ([0, 17727] - [0, 17728]):unsigned32 by call to `dtls1_process_record`. Showing all 13 steps of the trace ssl/d1_pkt.c:299:1: Parameter `s->s3->rrec.length` 297. &((s)->d1->processed_rcds)) 298. 299. > static int 300. dtls1_process_buffered_records(SSL *s) 301. { ssl/d1_pkt.c:315:20: Call 313. { 314. dtls1_get_unprocessed_record(s); 315. if ( ! dtls1_process_record(s)) ^ 316. return(0); 317. dtls1_buffer_record(s, &(s->d1->processed_rcds), ssl/d1_pkt.c:376:1: Parameter `s->s3->rrec.length` 374. #endif 375. 376. > static int 377. dtls1_process_record(SSL *s) 378. { ssl/d1_pkt.c:469:4: Call 467. * */ 468. mac = mac_tmp; 469. ssl3_cbc_copy_mac(mac_tmp, rr, mac_size); ^ 470. rr->length -= mac_size; 471. } ssl/s3_cbc.c:215:1: Parameter `md_size` 213. #define CBC_MAC_ROTATE_IN_PLACE 214. 215. > void ssl3_cbc_copy_mac(unsigned char* out, 216. const SSL3_RECORD *rec, 217. unsigned md_size) ssl/s3_cbc.c:261:29: Call 259. { 260. unsigned char mac_started = constant_time_ge_8(i, mac_start); 261. unsigned char mac_ended = constant_time_ge_8(i, mac_end); ^ 262. unsigned char b = rec->data[i]; 263. rotated_mac[j++] |= b & mac_started & ~mac_ended; crypto/constant_time_locl.h:140:1: Parameter `a` 138. } 139. 140. > static inline unsigned char constant_time_ge_8(unsigned int a, unsigned int b) 141. { 142. return (unsigned char)(constant_time_ge(a, b)); crypto/constant_time_locl.h:142:25: Call 140. static inline unsigned char constant_time_ge_8(unsigned int a, unsigned int b) 141. { 142. return (unsigned char)(constant_time_ge(a, b)); ^ 143. } 144. crypto/constant_time_locl.h:130:1: <LHS trace> 128. } 129. 130. > static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) 131. { 132. unsigned int ge; crypto/constant_time_locl.h:130:1: Parameter `a` 128. } 129. 130. > static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) 131. { 132. unsigned int ge; crypto/constant_time_locl.h:130:1: <RHS trace> 128. } 129. 130. > static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) 131. { 132. unsigned int ge; crypto/constant_time_locl.h:130:1: Parameter `b` 128. } 129. 130. > static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) 131. { 132. unsigned int ge; crypto/constant_time_locl.h:134:2: Binary operation: ([0, 17727] - [0, 17728]):unsigned32 by call to `dtls1_process_record` 132. unsigned int ge; 133. /* Case 1: msb(a) == msb(b). a >= b iff the MSB of a - b is not set.*/ 134. ge = ~((a ^ b) | (a - b)); ^ 135. /* Case 2: msb(a) != msb(b). a >= b iff the MSB of a is set. */ 136. ge |= a & ~b;
https://github.com/openssl/openssl/blob/360928b7d0f16dde70e26841bbf9e1af727e8b8f/crypto/constant_time_locl.h/#L134
d2a_code_trace_data_45037
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/tak.c:132: error: Integer Overflow L2 ([1, +oo] - 3):unsigned32 by call to `bitstream_read`. libavcodec/tak.c:132:21: Call 130. } 131. 132. ti->flags = bitstream_read(bc, TAK_FRAME_HEADER_FLAGS_BITS); ^ 133. ti->frame_num = bitstream_read(bc, TAK_FRAME_HEADER_NO_BITS); 134. 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:194:12: Call 192. } 193. 194. return get_val(bc, n); ^ 195. } 196. 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] - 3):unsigned32 by call to `bitstream_read` 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_45038
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) { int i; BN_ULONG *A; const BN_ULONG *B; bn_check_top(b); if (a == b) return(a); if (bn_wexpand(a,b->top) == NULL) return(NULL); #if 1 A=a->d; B=b->d; for (i=b->top>>2; i>0; i--,A+=4,B+=4) { BN_ULONG a0,a1,a2,a3; a0=B[0]; a1=B[1]; a2=B[2]; a3=B[3]; A[0]=a0; A[1]=a1; A[2]=a2; A[3]=a3; } switch (b->top&3) { case 3: A[2]=B[2]; case 2: A[1]=B[1]; case 1: A[0]=B[0]; case 0: ; } #else memcpy(a->d,b->d,sizeof(b->d[0])*b->top); #endif a->top=b->top; a->neg=b->neg; bn_check_top(a); return(a); } crypto/bn/bn_mont.c:421: error: BUFFER_OVERRUN_L1 Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: 2 by call to `BN_mod_inverse`. Showing all 11 steps of the trace crypto/bn/bn_mont.c:355:1: Array declaration 353. } 354. 355. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 356. { 357. int ret = 0; crypto/bn/bn_mont.c:372:3: Assignment 370. 371. BN_init(&tmod); 372. tmod.d=buf; ^ 373. tmod.dmax=2; 374. tmod.neg=0; crypto/bn/bn_mont.c:421:8: Call 419. tmod.top = buf[0] != 0 ? 1 : 0; 420. /* Ri = R^-1 mod N*/ 421. if ((BN_mod_inverse(Ri,R,&tmod,ctx)) == NULL) ^ 422. goto err; 423. if (!BN_lshift(Ri,Ri,BN_BITS2)) goto err; /* R*Ri */ crypto/bn/bn_gcd.c:209:1: Parameter `*n->d` 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 `*n->d` 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:538:6: Call 536. BN_zero(Y); 537. if (BN_copy(B,a) == NULL) goto err; 538. if (BN_copy(A,n) == NULL) goto err; ^ 539. A->neg = 0; 540. crypto/bn/bn_lib.c:478:1: <Length trace> 476. } 477. 478. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 479. { 480. int i; crypto/bn/bn_lib.c:478:1: Parameter `*b->d` 476. } 477. 478. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 479. { 480. int i; crypto/bn/bn_lib.c:491:2: Assignment 489. #if 1 490. A=a->d; 491. B=b->d; ^ 492. for (i=b->top>>2; i>0; i--,A+=4,B+=4) 493. { crypto/bn/bn_lib.c:495:33: Array access: Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: 2 by call to `BN_mod_inverse` 493. { 494. BN_ULONG a0,a1,a2,a3; 495. a0=B[0]; a1=B[1]; a2=B[2]; a3=B[3]; ^ 496. A[0]=a0; A[1]=a1; A[2]=a2; A[3]=a3; 497. }
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bn/bn_lib.c/#L495
d2a_code_trace_data_45039
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/takdec.c:811: error: Integer Overflow L2 ([1, +oo] - 2):unsigned32 by call to `bitstream_read`. libavcodec/takdec.c:811:49: Call 809. s->mcdparams[i].present = bitstream_read_bit(bc); 810. if (s->mcdparams[i].present) { 811. s->mcdparams[i].index = bitstream_read(bc, 2); ^ 812. s->mcdparams[i].chan2 = bitstream_read(bc, 4); 813. if (s->mcdparams[i].chan2 >= avctx->channels) { 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:194:12: Call 192. } 193. 194. return get_val(bc, n); ^ 195. } 196. 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] - 2):unsigned32 by call to `bitstream_read` 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_45040
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->staticbuf == NULL && (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; } if (allocbytes != NULL) *allocbytes = WPACKET_get_curr(pkt); return 1; } ssl/statem/statem_clnt.c:3119: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 1]):unsigned64 by call to `WPACKET_sub_memcpy__`. Showing all 14 steps of the trace ssl/statem/statem_clnt.c:3111:1: Parameter `pkt->written` 3109. 3110. #ifndef OPENSSL_NO_NEXTPROTONEG 3111. > int tls_construct_next_proto(SSL *s, WPACKET *pkt) 3112. { 3113. size_t len, padding_len; ssl/statem/statem_clnt.c:3119:10: Call 3117. padding_len = 32 - ((len + 2) % 32); 3118. 3119. if (!WPACKET_sub_memcpy_u8(pkt, s->ext.npn, len) ^ 3120. || !WPACKET_sub_allocate_bytes_u8(pkt, padding_len, &padding)) { 3121. SSLerr(SSL_F_TLS_CONSTRUCT_NEXT_PROTO, ERR_R_INTERNAL_ERROR); ssl/packet.c:348:10: Call 346. size_t lenbytes) 347. { 348. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) ^ 349. || !WPACKET_memcpy(pkt, src, len) 350. || !WPACKET_close(pkt)) ssl/packet.c:252:1: Parameter `pkt->buf->length` 250. } 251. 252. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 253. { 254. WPACKET_SUB *sub; ssl/packet.c:349:17: Call 347. { 348. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) 349. || !WPACKET_memcpy(pkt, src, len) ^ 350. || !WPACKET_close(pkt)) 351. return 0; ssl/packet.c:330:1: Parameter `pkt->written` 328. } 329. 330. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 331. { 332. unsigned char *dest; ssl/packet.c:337:10: Call 335. return 1; 336. 337. if (!WPACKET_allocate_bytes(pkt, len, &dest)) ^ 338. return 0; 339. 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:39:1: <LHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `pkt->buf->length` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: <RHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `len` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:49:36: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 1]):unsigned64 by call to `WPACKET_sub_memcpy__` 47. return 0; 48. 49. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { ^ 50. size_t newlen; 51. size_t reflen;
https://github.com/openssl/openssl/blob/f61c5ca6ca183bf0a51651857e3efb02a98889ad/ssl/packet.c/#L49
d2a_code_trace_data_45041
void bn_correct_top(BIGNUM *a) { BN_ULONG *ftl; int tmp_top = a->top; if (tmp_top > 0) { for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) { ftl--; if (*ftl != 0) break; } a->top = tmp_top; } if (a->top == 0) a->neg = 0; bn_pollute(a); } crypto/bn/bn_recp.c:69: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mul`. Showing all 14 steps of the trace crypto/bn/bn_recp.c:62:14: Call 60. 61. BN_CTX_start(ctx); 62. if ((a = BN_CTX_get(ctx)) == NULL) ^ 63. goto err; 64. if (y != NULL) { crypto/bn/bn_ctx.c:229:5: Call 227. } 228. /* OK, make sure the returned bignum is "zero" */ 229. BN_zero(ret); ^ 230. ctx->used++; 231. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:463:1: Parameter `*a->d` 461. } 462. 463. > int BN_set_word(BIGNUM *a, BN_ULONG w) 464. { 465. bn_check_top(a); crypto/bn/bn_lib.c:466:9: Call 464. { 465. bn_check_top(a); 466. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 467. return (0); 468. a->neg = 0; crypto/bn/bn_lcl.h:676:1: Parameter `*a->d` 674. int bn_probable_prime_dh_coprime(BIGNUM *rnd, int bits, BN_CTX *ctx); 675. 676. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 677. { 678. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_recp.c:69:18: Call 67. goto err; 68. } else { 69. if (!BN_mul(a, x, y, ctx)) ^ 70. goto err; 71. } crypto/bn/bn_mul.c:879:13: Assignment 877. if (bn_wexpand(rr, 16) == NULL) 878. goto err; 879. rr->top = 16; ^ 880. bn_mul_comba8(rr->d, a->d, b->d); 881. goto end; crypto/bn/bn_mul.c:972:5: Call 970. end: 971. #endif 972. bn_correct_top(rr); ^ 973. if (r != rr && BN_copy(r, rr) == NULL) 974. goto err; crypto/bn/bn_lib.c:1021:1: <Offset trace> 1019. } 1020. 1021. > void bn_correct_top(BIGNUM *a) 1022. { 1023. BN_ULONG *ftl; crypto/bn/bn_lib.c:1021:1: Parameter `a->top` 1019. } 1020. 1021. > void bn_correct_top(BIGNUM *a) 1022. { 1023. BN_ULONG *ftl; crypto/bn/bn_lib.c:1024:5: Assignment 1022. { 1023. BN_ULONG *ftl; 1024. int tmp_top = a->top; ^ 1025. 1026. if (tmp_top > 0) { crypto/bn/bn_lib.c:1021:1: <Length trace> 1019. } 1020. 1021. > void bn_correct_top(BIGNUM *a) 1022. { 1023. BN_ULONG *ftl; crypto/bn/bn_lib.c:1021:1: Parameter `*a->d` 1019. } 1020. 1021. > void bn_correct_top(BIGNUM *a) 1022. { 1023. BN_ULONG *ftl; crypto/bn/bn_lib.c:1027:14: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mul` 1025. 1026. if (tmp_top > 0) { 1027. for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) { ^ 1028. ftl--; 1029. if (*ftl != 0)
https://github.com/openssl/openssl/blob/d7c42d71ba407a4b3c26ed58263ae225976bbac3/crypto/bn/bn_lib.c/#L1027
d2a_code_trace_data_45042
int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop, OSSL_PROPERTY_LIST *pl) { PROPERTY_DEFN_ELEM elem, *old, *p = NULL; size_t len; LHASH_OF(PROPERTY_DEFN_ELEM) *property_defns; property_defns = openssl_ctx_get_data(ctx, OPENSSL_CTX_PROPERTY_DEFN_INDEX, &property_defns_method); if (property_defns == NULL) return 0; if (prop == NULL) return 1; if (pl == NULL) { elem.prop = prop; lh_PROPERTY_DEFN_ELEM_delete(property_defns, &elem); return 1; } len = strlen(prop); p = OPENSSL_malloc(sizeof(*p) + len); if (p != NULL) { p->prop = p->body; p->defn = pl; memcpy(p->body, prop, len + 1); old = lh_PROPERTY_DEFN_ELEM_insert(property_defns, p); if (old != NULL) { property_defn_free(old); return 1; } if (!lh_PROPERTY_DEFN_ELEM_error(property_defns)) return 1; } OPENSSL_free(p); return 0; } test/property_test.c:339: error: BUFFER_OVERRUN_L3 Offset added: [1, +oo] Size: [0, +oo] by call to `ossl_method_store_add`. Showing all 10 steps of the trace test/property_test.c:322:1: Array declaration 320. } 321. 322. > static int test_query_cache_stochastic(void) 323. { 324. const int max = 10000, tail = 10; test/property_test.c:339:14: Call 337. v[i] = 2 * i; 338. BIO_snprintf(buf, sizeof(buf), "n=%d\n", i); 339. if (!TEST_true(ossl_method_store_add(store, i, buf, "abc", NULL)) ^ 340. || !TEST_true(ossl_method_store_cache_set(store, i, buf, v + i)) 341. || !TEST_true(ossl_method_store_cache_set(store, i, "n=1234", crypto/property/property.c:176:1: Parameter `*properties` 174. } 175. 176. > int ossl_method_store_add(OSSL_METHOD_STORE *store, 177. int nid, const char *properties, 178. void *method, void (*method_destruct)(void *)) crypto/property/property.c:208:9: Call 206. if (impl->properties == NULL) 207. goto err; 208. ossl_prop_defn_set(store->ctx, properties, impl->properties); ^ 209. } 210. crypto/property/defn_cache.c:84:1: <Offset trace> 82. } 83. 84. > int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop, 85. OSSL_PROPERTY_LIST *pl) 86. { crypto/property/defn_cache.c:84:1: Parameter `prop->strlen` 82. } 83. 84. > int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop, 85. OSSL_PROPERTY_LIST *pl) 86. { crypto/property/defn_cache.c:104:5: Assignment 102. return 1; 103. } 104. len = strlen(prop); ^ 105. p = OPENSSL_malloc(sizeof(*p) + len); 106. if (p != NULL) { crypto/property/defn_cache.c:84:1: <Length trace> 82. } 83. 84. > int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop, 85. OSSL_PROPERTY_LIST *pl) 86. { crypto/property/defn_cache.c:84:1: Parameter `*prop` 82. } 83. 84. > int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop, 85. OSSL_PROPERTY_LIST *pl) 86. { crypto/property/defn_cache.c:109:9: Array access: Offset added: [1, +oo] Size: [0, +oo] by call to `ossl_method_store_add` 107. p->prop = p->body; 108. p->defn = pl; 109. memcpy(p->body, prop, len + 1); ^ 110. old = lh_PROPERTY_DEFN_ELEM_insert(property_defns, p); 111. if (old != NULL) {
https://github.com/openssl/openssl/blob/260a16f33682a819414fcba6161708a5e6bdff50/crypto/property/defn_cache.c/#L109
d2a_code_trace_data_45043
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_chk.c:86: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul`. Showing all 21 steps of the trace crypto/rsa/rsa_chk.c:65:9: Call 63. 64. /* p prime? */ 65. if (BN_is_prime_ex(key->p, BN_prime_checks, NULL, cb) != 1) { ^ 66. ret = 0; 67. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_P_NOT_PRIME); crypto/bn/bn_prime.c:145:1: Parameter `ctx_passed->stack.depth` 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 `ctx_passed->stack.depth` 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/rsa/rsa_chk.c:71:9: Call 69. 70. /* q prime? */ 71. if (BN_is_prime_ex(key->q, BN_prime_checks, NULL, cb) != 1) { ^ 72. ret = 0; 73. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_Q_NOT_PRIME); crypto/bn/bn_prime.c:145:1: Parameter `ctx_passed->stack.depth` 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 `ctx_passed->stack.depth` 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/rsa/rsa_chk.c:86:10: Call 84. 85. /* n = p*q * r_3...r_i? */ 86. if (!BN_mul(i, key->p, key->q, ctx)) { ^ 87. ret = -1; 88. goto err; 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 = bn_mul_fixed_top(r, a, b, ctx); crypto/bn/bn_mul.c:499:15: Call 497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); ^ 500. 501. bn_correct_top(r); crypto/bn/bn_mul.c:533:5: Call 531. top = al + bl; 532. 533. BN_CTX_start(ctx); ^ 534. if ((r == a) || (r == b)) { 535. if ((rr = BN_CTX_get(ctx)) == NULL) 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_mul.c:618:5: Call 616. err: 617. bn_check_top(r); 618. BN_CTX_end(ctx); ^ 619. return ret; 620. } 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_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_45044
void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) { #ifdef POLY1305_ASM poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks; #endif size_t rem, num; if ((num = ctx->num)) { rem = POLY1305_BLOCK_SIZE - num; if (len >= rem) { memcpy(ctx->data + num, inp, rem); poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1); inp += rem; len -= rem; } else { memcpy(ctx->data + num, inp, len); ctx->num = num + len; return; } } rem = len % POLY1305_BLOCK_SIZE; len -= rem; if (len >= POLY1305_BLOCK_SIZE) { poly1305_blocks(ctx->opaque, inp, len, 1); inp += len; } if (rem) memcpy(ctx->data, inp, rem); ctx->num = rem; } test/poly1305_internal_test.c:65: error: INTEGER_OVERFLOW_L2 ([1, +oo] - [-15, 15]):unsigned64 by call to `Poly1305_Update`. Showing all 7 steps of the trace test/poly1305_internal_test.c:65:9: Call 63. for (i=0;i<10000;i++) { 64. Poly1305_Init(&poly1305, key); 65. Poly1305_Update(&poly1305,buf,16); ^ 66. Poly1305_Final(&poly1305,buf); 67. } crypto/poly1305/poly1305.c:471:1: <LHS trace> 469. #endif 470. 471. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 472. { 473. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:471:1: Parameter `len` 469. #endif 470. 471. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 472. { 473. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:471:1: <RHS trace> 469. #endif 470. 471. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 472. { 473. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:471:1: Parameter `len` 469. #endif 470. 471. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 472. { 473. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:499:5: Assignment 497. } 498. 499. rem = len % POLY1305_BLOCK_SIZE; ^ 500. len -= rem; 501. crypto/poly1305/poly1305.c:500:5: Binary operation: ([1, +oo] - [-15, 15]):unsigned64 by call to `Poly1305_Update` 498. 499. rem = len % POLY1305_BLOCK_SIZE; 500. len -= rem; ^ 501. 502. if (len >= POLY1305_BLOCK_SIZE) {
https://github.com/openssl/openssl/blob/10a3195fcf7d04ba519651cf12e945a8fe470a3c/crypto/poly1305/poly1305.c/#L500
d2a_code_trace_data_45045
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *A, *a = NULL; const BN_ULONG *B; int i; 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 = A = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = A = OPENSSL_zalloc(words * sizeof(*a)); if (A == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return (NULL); } #if 1 B = b->d; if (B != NULL) { for (i = b->top >> 2; i > 0; i--, A += 4, B += 4) { BN_ULONG a0, a1, a2, a3; a0 = B[0]; a1 = B[1]; a2 = B[2]; a3 = B[3]; A[0] = a0; A[1] = a1; A[2] = a2; A[3] = a3; } switch (b->top & 3) { case 3: A[2] = B[2]; case 2: A[1] = B[1]; case 1: A[0] = B[0]; case 0: ; } } #else memset(A, 0, sizeof(*A) * words); memcpy(A, b->d, sizeof(b->d[0]) * b->top); #endif return (a); } crypto/ec/ec2_mult.c:257: error: BUFFER_OVERRUN_L3 Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] by call to `bn_wexpand`. Showing all 14 steps of the trace crypto/ec/ec2_mult.c:248:10: Call 246. */ 247. BN_CTX_start(ctx); 248. x1 = BN_CTX_get(ctx); ^ 249. z1 = BN_CTX_get(ctx); 250. if (z1 == NULL) crypto/bn/bn_ctx.c:229:5: Call 227. } 228. /* OK, make sure the returned bignum is "zero" */ 229. BN_zero(ret); ^ 230. ctx->used++; 231. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:463:1: Parameter `*a->d` 461. } 462. 463. > int BN_set_word(BIGNUM *a, BN_ULONG w) 464. { 465. bn_check_top(a); crypto/bn/bn_lib.c:466:9: Call 464. { 465. bn_check_top(a); 466. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 467. return (0); 468. a->neg = 0; crypto/bn/bn_lcl.h:676:1: Parameter `*a->d` 674. int bn_probable_prime_dh_coprime(BIGNUM *rnd, int bits, BN_CTX *ctx); 675. 676. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 677. { 678. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/ec/ec2_mult.c:257:9: Call 255. 256. group_top = bn_get_top(group->field); 257. if (bn_wexpand(x1, group_top) == NULL ^ 258. || bn_wexpand(z1, group_top) == NULL 259. || bn_wexpand(x2, group_top) == NULL 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_lib.c:1018:37: Call 1016. BIGNUM *bn_wexpand(BIGNUM *a, int words) 1017. { 1018. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 1019. } 1020. crypto/bn/bn_lib.c:323:1: Parameter `*b->d` 321. */ 322. 323. > BIGNUM *bn_expand2(BIGNUM *b, int words) 324. { 325. bn_check_top(b); crypto/bn/bn_lib.c:328:23: Call 326. 327. if (words > b->dmax) { 328. BN_ULONG *a = bn_expand_internal(b, words); ^ 329. if (!a) 330. return 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, *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, *a = NULL; crypto/bn/bn_lib.c:272:5: Assignment 270. 271. #if 1 272. B = b->d; ^ 273. /* Check if the previous number needs to be copied */ 274. if (B != NULL) { crypto/bn/bn_lib.c:289:18: Array access: Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] by call to `bn_wexpand` 287. a1 = B[1]; 288. a2 = B[2]; 289. a3 = B[3]; ^ 290. A[0] = a0; 291. A[1] = a1;
https://github.com/openssl/openssl/blob/d7c42d71ba407a4b3c26ed58263ae225976bbac3/crypto/bn/bn_lib.c/#L289
d2a_code_trace_data_45046
void avformat_free_context(AVFormatContext *s) { int i; if (!s) return; av_opt_free(s); if (s->iformat && s->iformat->priv_class && s->priv_data) av_opt_free(s->priv_data); for (i = 0; i < s->nb_streams; i++) free_stream(&s->streams[i]); for (i = s->nb_programs - 1; i >= 0; i--) { av_dict_free(&s->programs[i]->metadata); av_freep(&s->programs[i]->stream_index); av_freep(&s->programs[i]); } av_freep(&s->programs); av_freep(&s->priv_data); while (s->nb_chapters--) { av_dict_free(&s->chapters[s->nb_chapters]->metadata); av_free(s->chapters[s->nb_chapters]); } av_freep(&s->chapters); av_dict_free(&s->metadata); av_freep(&s->streams); av_freep(&s->internal); av_free(s); } libavformat/segment.c:336: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `seg_free_context`. libavformat/segment.c:324:32: Unknown value from: non-const function 322. if (seg->size && !(seg->number % seg->size)) { 323. ff_format_io_close(s, &seg->pb); 324. if ((ret = s->io_open(s, &seg->pb, seg->list, ^ 325. AVIO_FLAG_WRITE, NULL)) < 0) 326. goto fail; libavformat/segment.c:336:9: Call 334. fail: 335. if (ret < 0) 336. seg_free_context(seg); ^ 337. 338. return ret; libavformat/segment.c:193:1: Parameter `seg->avf->nb_programs` 191. } 192. 193. static void seg_free_context(SegmentContext *seg) ^ 194. { 195. ff_format_io_close(seg->avf, &seg->pb); libavformat/segment.c:196:5: Call 194. { 195. ff_format_io_close(seg->avf, &seg->pb); 196. avformat_free_context(seg->avf); ^ 197. seg->avf = NULL; 198. } libavformat/utils.c:2477:1: <LHS trace> 2475. } 2476. 2477. void avformat_free_context(AVFormatContext *s) ^ 2478. { 2479. int i; libavformat/utils.c:2477:1: Parameter `s->nb_programs` 2475. } 2476. 2477. void avformat_free_context(AVFormatContext *s) ^ 2478. { 2479. int i; libavformat/utils.c:2491:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `seg_free_context` 2489. free_stream(&s->streams[i]); 2490. 2491. for (i = s->nb_programs - 1; i >= 0; i--) { ^ 2492. av_dict_free(&s->programs[i]->metadata); 2493. av_freep(&s->programs[i]->stream_index);
https://github.com/libav/libav/blob/611ba89b896a5286b6d8ad9bfdbb8b4f5c11df9c/libavformat/utils.c/#L2491
d2a_code_trace_data_45047
ngx_int_t ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value, ngx_uint_t flags) { size_t len; u_char *p; ngx_str_t *name; ngx_uint_t i, k, n, skip, last; ngx_array_t *keys, *hwc; ngx_hash_key_t *hk; last = key->len; if (flags & NGX_HASH_WILDCARD_KEY) { n = 0; for (i = 0; i < key->len; i++) { if (key->data[i] == '*') { if (++n > 1) { return NGX_DECLINED; } } if (key->data[i] == '.' && key->data[i + 1] == '.') { return NGX_DECLINED; } } if (key->len > 1 && key->data[0] == '.') { skip = 1; goto wildcard; } if (key->len > 2) { if (key->data[0] == '*' && key->data[1] == '.') { skip = 2; goto wildcard; } if (key->data[i - 2] == '.' && key->data[i - 1] == '*') { skip = 0; last -= 2; goto wildcard; } } if (n) { return NGX_DECLINED; } } k = 0; for (i = 0; i < last; i++) { if (!(flags & NGX_HASH_READONLY_KEY)) { key->data[i] = ngx_tolower(key->data[i]); } k = ngx_hash(k, key->data[i]); } k %= ha->hsize; name = ha->keys_hash[k].elts; if (name) { for (i = 0; i < ha->keys_hash[k].nelts; i++) { if (last != name[i].len) { continue; } if (ngx_strncmp(key->data, name[i].data, last) == 0) { return NGX_BUSY; } } } else { if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK) { return NGX_ERROR; } } name = ngx_array_push(&ha->keys_hash[k]); if (name == NULL) { return NGX_ERROR; } *name = *key; hk = ngx_array_push(&ha->keys); if (hk == NULL) { return NGX_ERROR; } hk->key = *key; hk->key_hash = ngx_hash_key(key->data, last); hk->value = value; return NGX_OK; wildcard: k = ngx_hash_strlow(&key->data[skip], &key->data[skip], last - skip); k %= ha->hsize; if (skip == 1) { name = ha->keys_hash[k].elts; if (name) { len = last - skip; for (i = 0; i < ha->keys_hash[k].nelts; i++) { if (len != name[i].len) { continue; } if (ngx_strncmp(&key->data[1], name[i].data, len) == 0) { return NGX_BUSY; } } } else { if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK) { return NGX_ERROR; } } name = ngx_array_push(&ha->keys_hash[k]); if (name == NULL) { return NGX_ERROR; } name->len = last - 1; name->data = ngx_pnalloc(ha->temp_pool, name->len); if (name->data == NULL) { return NGX_ERROR; } ngx_memcpy(name->data, &key->data[1], name->len); } if (skip) { p = ngx_pnalloc(ha->temp_pool, last); if (p == NULL) { return NGX_ERROR; } len = 0; n = 0; for (i = last - 1; i; i--) { if (key->data[i] == '.') { ngx_memcpy(&p[n], &key->data[i + 1], len); n += len; p[n++] = '.'; len = 0; continue; } len++; } if (len) { ngx_memcpy(&p[n], &key->data[1], len); n += len; } p[n] = '\0'; hwc = &ha->dns_wc_head; keys = &ha->dns_wc_head_hash[k]; } else { last++; p = ngx_pnalloc(ha->temp_pool, last); if (p == NULL) { return NGX_ERROR; } ngx_cpystrn(p, key->data, last); hwc = &ha->dns_wc_tail; keys = &ha->dns_wc_tail_hash[k]; } hk = ngx_array_push(hwc); if (hk == NULL) { return NGX_ERROR; } hk->key.len = last - 1; hk->key.data = p; hk->key_hash = 0; hk->value = value; name = keys->elts; if (name) { len = last - skip; for (i = 0; i < keys->nelts; i++) { if (len != name[i].len) { continue; } if (ngx_strncmp(key->data + skip, name[i].data, len) == 0) { return NGX_BUSY; } } } else { if (ngx_array_init(keys, ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK) { return NGX_ERROR; } } name = ngx_array_push(keys); if (name == NULL) { return NGX_ERROR; } name->len = last - skip; name->data = ngx_pnalloc(ha->temp_pool, name->len); if (name->data == NULL) { return NGX_ERROR; } ngx_memcpy(name->data, key->data + skip, name->len); return NGX_OK; } src/http/modules/ngx_http_ssi_filter_module.c:2654: error: Buffer Overrun L3 Offset: [-1, +oo] Size: [1, +oo] by call to `ngx_http_add_variable`. src/http/modules/ngx_http_ssi_filter_module.c:2654:15: Call 2652. 2653. for (v = ngx_http_ssi_vars; v->name.len; v++) { 2654. var = ngx_http_add_variable(cf, &v->name, v->flags); ^ 2655. if (var == NULL) { 2656. return NGX_ERROR; src/http/ngx_http_variables.c:257:1: Parameter `name->len` 255. 256. 257. ngx_http_variable_t * ^ 258. ngx_http_add_variable(ngx_conf_t *cf, ngx_str_t *name, ngx_uint_t flags) 259. { src/http/modules/ngx_http_ssi_filter_module.c:2654:15: Call 2652. 2653. for (v = ngx_http_ssi_vars; v->name.len; v++) { 2654. var = ngx_http_add_variable(cf, &v->name, v->flags); ^ 2655. if (var == NULL) { 2656. return NGX_ERROR; src/http/ngx_http_variables.c:257:1: Parameter `name->len` 255. 256. 257. ngx_http_variable_t * ^ 258. ngx_http_add_variable(ngx_conf_t *cf, ngx_str_t *name, ngx_uint_t flags) 259. { src/http/ngx_http_variables.c:292:5: Assignment 290. } 291. 292. v->name.len = name->len; ^ 293. v->name.data = ngx_pnalloc(cf->pool, name->len); 294. if (v->name.data == NULL) { src/http/ngx_http_variables.c:306:10: Call 304. v->index = 0; 305. 306. rc = ngx_hash_add_key(cmcf->variables_keys, &v->name, v, 0); ^ 307. 308. if (rc == NGX_ERROR) { src/core/ngx_hash.c:713:1: <Offset trace> 711. 712. 713. ngx_int_t ^ 714. ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value, 715. ngx_uint_t flags) src/core/ngx_hash.c:713:1: Parameter `key->len` 711. 712. 713. ngx_int_t ^ 714. ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value, 715. ngx_uint_t flags) src/core/ngx_hash.c:713:1: <Length trace> 711. 712. 713. ngx_int_t ^ 714. ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value, 715. ngx_uint_t flags) src/core/ngx_hash.c:713:1: Parameter `*key->data` 711. 712. 713. ngx_int_t ^ 714. ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value, 715. ngx_uint_t flags) src/core/ngx_hash.c:760:17: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `ngx_http_add_variable` 758. } 759. 760. if (key->data[i - 2] == '.' && key->data[i - 1] == '*') { ^ 761. skip = 0; 762. last -= 2;
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_hash.c/#L760
d2a_code_trace_data_45048
TXT_DB *TXT_DB_read(BIO *in, int num) { TXT_DB *ret = NULL; int esc = 0; long ln = 0; int i, add, n; int size = BUFSIZE; int offset = 0; char *p, *f; OPENSSL_STRING *pp; BUF_MEM *buf = NULL; if ((buf = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(buf, size)) goto err; if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) goto err; ret->num_fields = num; ret->index = NULL; ret->qual = NULL; if ((ret->data = sk_OPENSSL_PSTRING_new_null()) == NULL) goto err; if ((ret->index = OPENSSL_malloc(sizeof(*ret->index) * num)) == NULL) goto err; if ((ret->qual = OPENSSL_malloc(sizeof(*(ret->qual)) * num)) == NULL) goto err; for (i = 0; i < num; i++) { ret->index[i] = NULL; ret->qual[i] = NULL; } add = (num + 1) * sizeof(char *); buf->data[size - 1] = '\0'; offset = 0; for (;;) { if (offset != 0) { size += BUFSIZE; if (!BUF_MEM_grow_clean(buf, size)) goto err; } buf->data[offset] = '\0'; BIO_gets(in, &(buf->data[offset]), size - offset); ln++; if (buf->data[offset] == '\0') break; if ((offset == 0) && (buf->data[0] == '#')) continue; i = strlen(&(buf->data[offset])); offset += i; if (buf->data[offset - 1] != '\n') continue; else { buf->data[offset - 1] = '\0'; if ((p = OPENSSL_malloc(add + offset)) == NULL) goto err; offset = 0; } pp = (char **)p; p += add; n = 0; pp[n++] = p; i = 0; f = buf->data; esc = 0; for (;;) { if (*f == '\0') break; if (*f == '\t') { if (esc) p--; else { *(p++) = '\0'; f++; if (n >= num) break; pp[n++] = p; continue; } } esc = (*f == '\\'); *(p++) = *(f++); } *(p++) = '\0'; if ((n != num) || (*f != '\0')) { OPENSSL_free(pp); ret->error = DB_ERROR_WRONG_NUM_FIELDS; goto err; } pp[n] = p; if (!sk_OPENSSL_PSTRING_push(ret->data, pp)) { OPENSSL_free(pp); goto err; } } BUF_MEM_free(buf); return ret; err: BUF_MEM_free(buf); if (ret != NULL) { sk_OPENSSL_PSTRING_free(ret->data); OPENSSL_free(ret->index); OPENSSL_free(ret->qual); OPENSSL_free(ret); } return (NULL); } apps/apps.c:1518: error: BUFFER_OVERRUN_L3 Offset: 6 Size: [1, +oo] by call to `TXT_DB_read`. Showing all 11 steps of the trace apps/apps.c:1518:18: Call 1516. goto err; 1517. } 1518. if ((tmpdb = TXT_DB_read(in, DB_NUMBER)) == NULL) ^ 1519. goto err; 1520. crypto/txt_db/txt_db.c:20:1: <Offset trace> 18. #define BUFSIZE 512 19. 20. > TXT_DB *TXT_DB_read(BIO *in, int num) 21. { 22. TXT_DB *ret = NULL; crypto/txt_db/txt_db.c:20:1: Parameter `num` 18. #define BUFSIZE 512 19. 20. > TXT_DB *TXT_DB_read(BIO *in, int num) 21. { 22. TXT_DB *ret = NULL; crypto/txt_db/txt_db.c:20:1: <Length trace> 18. #define BUFSIZE 512 19. 20. > TXT_DB *TXT_DB_read(BIO *in, int num) 21. { 22. TXT_DB *ret = NULL; crypto/txt_db/txt_db.c:20:1: Parameter `num` 18. #define BUFSIZE 512 19. 20. > TXT_DB *TXT_DB_read(BIO *in, int num) 21. { 22. TXT_DB *ret = NULL; crypto/txt_db/txt_db.c:53:5: Assignment 51. } 52. 53. add = (num + 1) * sizeof(char *); ^ 54. buf->data[size - 1] = '\0'; 55. offset = 0; crypto/txt_db/txt_db.c:75:22: Call 73. else { 74. buf->data[offset - 1] = '\0'; /* blat the '\n' */ 75. if ((p = OPENSSL_malloc(add + offset)) == NULL) ^ 76. goto err; 77. offset = 0; crypto/mem.c:166:9: Assignment 164. 165. if (num == 0) 166. return NULL; ^ 167. 168. FAILTEST(); crypto/txt_db/txt_db.c:75:18: Assignment 73. else { 74. buf->data[offset - 1] = '\0'; /* blat the '\n' */ 75. if ((p = OPENSSL_malloc(add + offset)) == NULL) ^ 76. goto err; 77. offset = 0; crypto/txt_db/txt_db.c:79:9: Assignment 77. offset = 0; 78. } 79. pp = (char **)p; ^ 80. p += add; 81. n = 0; crypto/txt_db/txt_db.c:111:9: Array access: Offset: 6 Size: [1, +oo] by call to `TXT_DB_read` 109. goto err; 110. } 111. pp[n] = p; ^ 112. if (!sk_OPENSSL_PSTRING_push(ret->data, pp)) { 113. OPENSSL_free(pp);
https://github.com/openssl/openssl/blob/1b8f19379a521ec11ce37e12316dd3edc0acfb82/crypto/txt_db/txt_db.c/#L111
d2a_code_trace_data_45049
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_picture_type_char(enc->coded_frame->pict_type)); } } ffmpeg.c:1303: error: Null Dereference pointer `vstats_file` last assigned on line 1293 could be null and is dereferenced by call to `fprintf()` at line 1303, column 9. ffmpeg.c:1284:1: start of procedure do_video_stats() 1282. } 1283. 1284. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost, ^ 1285. int frame_size) 1286. { ffmpeg.c:1292:10: Taking true branch 1290. 1291. /* this is executed just the first time do_video_stats is called */ 1292. if (!vstats_file) { ^ 1293. vstats_file = fopen(vstats_filename, "w"); 1294. if (!vstats_file) { ffmpeg.c:1293:9: 1291. /* this is executed just the first time do_video_stats is called */ 1292. if (!vstats_file) { 1293. vstats_file = fopen(vstats_filename, "w"); ^ 1294. if (!vstats_file) { 1295. perror("fopen"); ffmpeg.c:1294:14: Taking true branch 1292. if (!vstats_file) { 1293. vstats_file = fopen(vstats_filename, "w"); 1294. if (!vstats_file) { ^ 1295. perror("fopen"); 1296. ffmpeg_exit(1); ffmpeg.c:1295:13: 1293. vstats_file = fopen(vstats_filename, "w"); 1294. if (!vstats_file) { 1295. perror("fopen"); ^ 1296. ffmpeg_exit(1); 1297. } ffmpeg.c:1296:13: Skipping ffmpeg_exit(): empty list of specs 1294. if (!vstats_file) { 1295. perror("fopen"); 1296. ffmpeg_exit(1); ^ 1297. } 1298. } ffmpeg.c:1300:5: 1298. } 1299. 1300. enc = ost->st->codec; ^ 1301. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1302. frame_number = ost->frame_number; ffmpeg.c:1301:9: Taking true branch 1299. 1300. enc = ost->st->codec; 1301. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { ^ 1302. frame_number = ost->frame_number; 1303. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); ffmpeg.c:1302:9: 1300. enc = ost->st->codec; 1301. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1302. frame_number = ost->frame_number; ^ 1303. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); 1304. if (enc->flags&CODEC_FLAG_PSNR) ffmpeg.c:1303:9: 1301. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1302. frame_number = ost->frame_number; 1303. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); ^ 1304. if (enc->flags&CODEC_FLAG_PSNR) 1305. 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/41e21e4db623ebd77f431a6f30cf21d62d9e1f33/ffmpeg.c/#L1303
d2a_code_trace_data_45050
static int add_custom_ext_intern(SSL_CTX *ctx, ENDPOINT role, unsigned int ext_type, unsigned int context, SSL_custom_ext_add_cb_ex add_cb, SSL_custom_ext_free_cb_ex free_cb, void *add_arg, SSL_custom_ext_parse_cb_ex parse_cb, void *parse_arg) { custom_ext_methods *exts = &ctx->cert->custext; custom_ext_method *meth, *tmp; if (add_cb == NULL && free_cb != NULL) return 0; #ifndef OPENSSL_NO_CT if (ext_type == TLSEXT_TYPE_signed_certificate_timestamp && (context & SSL_EXT_CLIENT_HELLO) != 0 && SSL_CTX_ct_is_enabled(ctx)) return 0; #endif if (SSL_extension_supported(ext_type) && ext_type != TLSEXT_TYPE_signed_certificate_timestamp) return 0; if (ext_type > 0xffff) return 0; if (custom_ext_find(exts, role, ext_type, NULL)) return 0; tmp = OPENSSL_realloc(exts->meths, (exts->meths_count + 1) * sizeof(custom_ext_method)); if (tmp == NULL) return 0; exts->meths = tmp; meth = exts->meths + exts->meths_count; memset(meth, 0, sizeof(*meth)); meth->role = role; meth->context = context; meth->parse_cb = parse_cb; meth->add_cb = add_cb; meth->free_cb = free_cb; meth->ext_type = ext_type; meth->add_arg = add_arg; meth->parse_arg = parse_arg; exts->meths_count++; return 1; } test/sslapitest.c:4189: error: BUFFER_OVERRUN_L3 Offset added: [56, +oo] (⇐ [0, +oo] + 56) Size: [1, +oo] by call to `SSL_CTX_add_custom_ext`. Showing all 21 steps of the trace test/sslapitest.c:4158:14: Call 4156. /* Create a client side custom extension */ 4157. if (tst == 0) { 4158. if (!TEST_true(SSL_CTX_add_client_custom_ext(cctx, TEST_EXT_TYPE1, ^ 4159. old_add_cb, old_free_cb, 4160. &client, old_parse_cb, ssl/statem/extensions_cust.c:450:1: Parameter `ctx->cert->custext.meths_count` 448. 449. /* Application level functions to add the old custom extension callbacks */ 450. > int SSL_CTX_add_client_custom_ext(SSL_CTX *ctx, unsigned int ext_type, 451. custom_ext_add_cb add_cb, 452. custom_ext_free_cb free_cb, ssl/statem/extensions_cust.c:456:12: Call 454. custom_ext_parse_cb parse_cb, void *parse_arg) 455. { 456. return add_old_custom_ext(ctx, ENDPOINT_CLIENT, ext_type, ^ 457. SSL_EXT_TLS1_2_AND_BELOW_ONLY 458. | SSL_EXT_CLIENT_HELLO ssl/statem/extensions_cust.c:407:1: Parameter `ctx->cert->custext.meths_count` 405. } 406. 407. > static int add_old_custom_ext(SSL_CTX *ctx, ENDPOINT role, 408. unsigned int ext_type, 409. unsigned int context, test/sslapitest.c:4171:10: Call 4169. 4170. /* Should not be able to add duplicates */ 4171. if (!TEST_false(SSL_CTX_add_client_custom_ext(cctx, TEST_EXT_TYPE1, ^ 4172. old_add_cb, old_free_cb, 4173. &client, old_parse_cb, ssl/statem/extensions_cust.c:450:1: Parameter `ctx->cert->custext.meths_count` 448. 449. /* Application level functions to add the old custom extension callbacks */ 450. > int SSL_CTX_add_client_custom_ext(SSL_CTX *ctx, unsigned int ext_type, 451. custom_ext_add_cb add_cb, 452. custom_ext_free_cb free_cb, ssl/statem/extensions_cust.c:456:12: Call 454. custom_ext_parse_cb parse_cb, void *parse_arg) 455. { 456. return add_old_custom_ext(ctx, ENDPOINT_CLIENT, ext_type, ^ 457. SSL_EXT_TLS1_2_AND_BELOW_ONLY 458. | SSL_EXT_CLIENT_HELLO ssl/statem/extensions_cust.c:407:1: Parameter `ctx->cert->custext.meths_count` 405. } 406. 407. > static int add_old_custom_ext(SSL_CTX *ctx, ENDPOINT role, 408. unsigned int ext_type, 409. unsigned int context, test/sslapitest.c:4175:17: Call 4173. &client, old_parse_cb, 4174. &client)) 4175. || !TEST_false(SSL_CTX_add_custom_ext(cctx, TEST_EXT_TYPE1, ^ 4176. context, new_add_cb, 4177. new_free_cb, &client, ssl/statem/extensions_cust.c:478:1: Parameter `ctx->cert->custext.meths_count` 476. } 477. 478. > int SSL_CTX_add_custom_ext(SSL_CTX *ctx, unsigned int ext_type, 479. unsigned int context, 480. SSL_custom_ext_add_cb_ex add_cb, ssl/statem/extensions_cust.c:485:12: Call 483. SSL_custom_ext_parse_cb_ex parse_cb, void *parse_arg) 484. { 485. return add_custom_ext_intern(ctx, ENDPOINT_BOTH, ext_type, context, add_cb, ^ 486. free_cb, add_arg, parse_cb, parse_arg); 487. } ssl/statem/extensions_cust.c:342:1: Parameter `ctx->cert->custext.meths_count` 340. } 341. 342. > static int add_custom_ext_intern(SSL_CTX *ctx, ENDPOINT role, 343. unsigned int ext_type, 344. unsigned int context, test/sslapitest.c:4189:14: Call 4187. goto end; 4188. } else { 4189. if (!TEST_true(SSL_CTX_add_custom_ext(sctx, TEST_EXT_TYPE1, context, ^ 4190. new_add_cb, new_free_cb, 4191. &server, new_parse_cb, &server))) ssl/statem/extensions_cust.c:478:1: Parameter `ctx->cert->custext.meths_count` 476. } 477. 478. > int SSL_CTX_add_custom_ext(SSL_CTX *ctx, unsigned int ext_type, 479. unsigned int context, 480. SSL_custom_ext_add_cb_ex add_cb, ssl/statem/extensions_cust.c:485:12: Call 483. SSL_custom_ext_parse_cb_ex parse_cb, void *parse_arg) 484. { 485. return add_custom_ext_intern(ctx, ENDPOINT_BOTH, ext_type, context, add_cb, ^ 486. free_cb, add_arg, parse_cb, parse_arg); 487. } ssl/statem/extensions_cust.c:342:1: <Length trace> 340. } 341. 342. > static int add_custom_ext_intern(SSL_CTX *ctx, ENDPOINT role, 343. unsigned int ext_type, 344. unsigned int context, ssl/statem/extensions_cust.c:342:1: Parameter `ctx->cert->custext.meths_count` 340. } 341. 342. > static int add_custom_ext_intern(SSL_CTX *ctx, ENDPOINT role, 343. unsigned int ext_type, 344. unsigned int context, ssl/statem/extensions_cust.c:385:9: Call 383. return 0; 384. /* Search for duplicate */ 385. if (custom_ext_find(exts, role, ext_type, NULL)) ^ 386. return 0; 387. tmp = OPENSSL_realloc(exts->meths, ssl/statem/extensions_cust.c:81:1: Parameter `exts->meths_count` 79. * client, or ENDPOINT_BOTH for either 80. */ 81. > custom_ext_method *custom_ext_find(const custom_ext_methods *exts, 82. ENDPOINT role, unsigned int ext_type, 83. size_t *idx) ssl/statem/extensions_cust.c:393:5: Assignment 391. 392. exts->meths = tmp; 393. meth = exts->meths + exts->meths_count; ^ 394. memset(meth, 0, sizeof(*meth)); 395. meth->role = role; ssl/statem/extensions_cust.c:394:5: Array access: Offset added: [56, +oo] (⇐ [0, +oo] + 56) Size: [1, +oo] by call to `SSL_CTX_add_custom_ext` 392. exts->meths = tmp; 393. meth = exts->meths + exts->meths_count; 394. memset(meth, 0, sizeof(*meth)); ^ 395. meth->role = role; 396. meth->context = context;
https://github.com/openssl/openssl/blob/260a16f33682a819414fcba6161708a5e6bdff50/ssl/statem/extensions_cust.c/#L394
d2a_code_trace_data_45051
int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len) { int al,i,j,n,ret; SSL3_RECORD *rr; void (*cb)()=NULL; BIO *bio; if (s->s3->rbuf.buf == NULL) if (!ssl3_setup_buffers(s)) return(-1); if ((type != SSL3_RT_APPLICATION_DATA) && (type != SSL3_RT_HANDSHAKE) && type) { SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_INTERNAL_ERROR); return -1; } if ((type == SSL3_RT_HANDSHAKE) && (s->s3->handshake_fragment_len > 0)) { unsigned char *src = s->s3->handshake_fragment; unsigned char *dst = buf; n = 0; while ((len > 0) && (s->s3->handshake_fragment_len > 0)) { *dst++ = *src++; len--; s->s3->handshake_fragment_len--; n++; } for (i = 0; i < s->s3->handshake_fragment_len; i++) s->s3->handshake_fragment[i] = *src++; ssl3_finish_mac(s, buf, n); return n; } if (!s->in_handshake && SSL_in_init(s)) { i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } } start: s->rwstate=SSL_NOTHING; rr = &(s->s3->rrec); if ((rr->length == 0) || (s->rstate == SSL_ST_READ_BODY)) { ret=ssl3_get_record(s); if (ret <= 0) return(ret); } if (s->s3->change_cipher_spec && (rr->type != SSL3_RT_HANDSHAKE)) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_DATA_BETWEEN_CCS_AND_FINISHED); goto err; } if (s->shutdown & SSL_RECEIVED_SHUTDOWN) { rr->length=0; s->rwstate=SSL_NOTHING; return(0); } if (type == rr->type) { if (SSL_in_init(s) && (type == SSL3_RT_APPLICATION_DATA) && (s->enc_read_ctx == NULL)) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_APP_DATA_IN_HANDSHAKE); goto f_err; } if (len <= 0) return(len); if ((unsigned int)len > rr->length) n=rr->length; else n=len; memcpy(buf,&(rr->data[rr->off]),(unsigned int)n); rr->length-=n; rr->off+=n; if (rr->length == 0) { s->rstate=SSL_ST_READ_HEADER; rr->off=0; } if (type == SSL3_RT_HANDSHAKE) ssl3_finish_mac(s,buf,n); return(n); } { int dest_maxlen = 0; unsigned char *dest; int *dest_len; if (rr->type == SSL3_RT_HANDSHAKE) { dest_maxlen = sizeof s->s3->handshake_fragment; dest = s->s3->handshake_fragment; dest_len = &s->s3->handshake_fragment_len; } else if (rr->type == SSL3_RT_ALERT) { dest_maxlen = sizeof s->s3->alert_fragment; dest = s->s3->alert_fragment; dest_len = &s->s3->alert_fragment_len; } if (dest_maxlen > 0) { n = dest_maxlen - *dest_len; if (rr->length < n) n = rr->length; while (n-- > 0) { dest[(*dest_len)++] = rr->data[rr->off++]; rr->length--; } if (*dest_len < dest_maxlen) goto start; } } if ((!s->server) && (s->s3->handshake_fragment_len >= 4) && (s->s3->handshake_fragment[0] == SSL3_MT_HELLO_REQUEST) && (s->session != NULL) && (s->session->cipher != NULL)) { s->s3->handshake_fragment_len = 0; if ((s->s3->handshake_fragment[1] != 0) || (s->s3->handshake_fragment[2] != 0) || (s->s3->handshake_fragment[3] != 0)) { al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_HELLO_REQUEST); goto err; } if (SSL_is_init_finished(s) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) && !s->s3->renegotiate) { ssl3_renegotiate(s); if (ssl3_renegotiate_check(s)) { n=s->handshake_func(s); if (n < 0) return(n); if (n == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } } } goto start; } if (s->s3->alert_fragment_len >= 2) { i = s->s3->alert_fragment[0]; n = s->s3->alert_fragment[1]; s->s3->alert_fragment_len = 0; if (s->info_callback != NULL) cb=s->info_callback; else if (s->ctx->info_callback != NULL) cb=s->ctx->info_callback; if (cb != NULL) { j=(i<<8)|n; cb(s,SSL_CB_READ_ALERT,j); } if (i == 1) { s->s3->warn_alert=n; if (n == SSL_AD_CLOSE_NOTIFY) { s->shutdown|=SSL_RECEIVED_SHUTDOWN; return(0); } } else if (i == 2) { char tmp[16]; s->rwstate=SSL_NOTHING; s->s3->fatal_alert=n; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_AD_REASON_OFFSET+n); sprintf(tmp,"%d",n); ERR_add_error_data(2,"SSL alert number ",tmp); s->shutdown|=SSL_RECEIVED_SHUTDOWN; SSL_CTX_remove_session(s->ctx,s->session); return(0); } else { al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNKNOWN_ALERT_TYPE); goto f_err; } goto start; } if (s->shutdown & SSL_SENT_SHUTDOWN) { s->rwstate=SSL_NOTHING; rr->length=0; return(0); } if (rr->type == SSL3_RT_CHANGE_CIPHER_SPEC) { if ( (rr->length != 1) || (rr->off != 0) || (rr->data[0] != SSL3_MT_CCS)) { i=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_CHANGE_CIPHER_SPEC); goto err; } rr->length=0; s->s3->change_cipher_spec=1; if (!do_change_cipher_spec(s)) goto err; else goto start; } if ((s->s3->handshake_fragment_len >= 4) && !s->in_handshake) { if (((s->state&SSL_ST_MASK) == SSL_ST_OK) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)) { s->state=SSL_ST_BEFORE|(s->server) ?SSL_ST_ACCEPT :SSL_ST_CONNECT; s->new_session=1; } n=s->handshake_func(s); if (n < 0) return(n); if (n == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } s->rwstate=SSL_READING; bio=SSL_get_rbio(s); BIO_clear_retry_flags(bio); BIO_set_retry_read(bio); return(-1); } switch (rr->type) { default: #ifndef NO_TLS if (s->version == TLS1_VERSION) { goto start; } #endif al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNEXPECTED_RECORD); goto f_err; case SSL3_RT_CHANGE_CIPHER_SPEC: case SSL3_RT_ALERT: case SSL3_RT_HANDSHAKE: al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_INTERNAL_ERROR); goto f_err; case SSL3_RT_APPLICATION_DATA: if (s->s3->in_read_app_data && (s->s3->total_renegotiations != 0) && (( (s->state & SSL_ST_CONNECT) && (s->state >= SSL3_ST_CW_CLNT_HELLO_A) && (s->state <= SSL3_ST_CR_SRVR_HELLO_A) ) || ( (s->state & SSL_ST_ACCEPT) && (s->state <= SSL3_ST_SW_HELLO_REQ_A) && (s->state >= SSL3_ST_SR_CLNT_HELLO_A) ) )) { s->s3->in_read_app_data=0; return(-1); } else { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNEXPECTED_RECORD); goto f_err; } } f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); err: return(-1); } ssl/s3_pkt.c:867: error: UNINITIALIZED_VALUE The value read from *dest_len was never initialized. Showing all 1 steps of the trace ssl/s3_pkt.c:867:8: 865. } 866. 867. > if (*dest_len < dest_maxlen) 868. goto start; /* fragment was too small */ 869. }
https://github.com/openssl/openssl/blob/dab6f09573742df94c4767663565aca3863f8173/ssl/s3_pkt.c/#L867
d2a_code_trace_data_45052
int SHA512_Final(unsigned char *md, SHA512_CTX *c) { unsigned char *p = (unsigned char *)c->u.p; size_t n = c->num; p[n] = 0x80; n++; if (n > (sizeof(c->u) - 16)) { memset(p + n, 0, sizeof(c->u) - n); n = 0; sha512_block_data_order(c, p, 1); } memset(p + n, 0, sizeof(c->u) - 16 - n); #ifdef B_ENDIAN c->u.d[SHA_LBLOCK - 2] = c->Nh; c->u.d[SHA_LBLOCK - 1] = c->Nl; #else p[sizeof(c->u) - 1] = (unsigned char)(c->Nl); p[sizeof(c->u) - 2] = (unsigned char)(c->Nl >> 8); p[sizeof(c->u) - 3] = (unsigned char)(c->Nl >> 16); p[sizeof(c->u) - 4] = (unsigned char)(c->Nl >> 24); p[sizeof(c->u) - 5] = (unsigned char)(c->Nl >> 32); p[sizeof(c->u) - 6] = (unsigned char)(c->Nl >> 40); p[sizeof(c->u) - 7] = (unsigned char)(c->Nl >> 48); p[sizeof(c->u) - 8] = (unsigned char)(c->Nl >> 56); p[sizeof(c->u) - 9] = (unsigned char)(c->Nh); p[sizeof(c->u) - 10] = (unsigned char)(c->Nh >> 8); p[sizeof(c->u) - 11] = (unsigned char)(c->Nh >> 16); p[sizeof(c->u) - 12] = (unsigned char)(c->Nh >> 24); p[sizeof(c->u) - 13] = (unsigned char)(c->Nh >> 32); p[sizeof(c->u) - 14] = (unsigned char)(c->Nh >> 40); p[sizeof(c->u) - 15] = (unsigned char)(c->Nh >> 48); p[sizeof(c->u) - 16] = (unsigned char)(c->Nh >> 56); #endif sha512_block_data_order(c, p, 1); if (md == 0) return 0; switch (c->md_len) { case SHA384_DIGEST_LENGTH: for (n = 0; n < SHA384_DIGEST_LENGTH / 8; n++) { SHA_LONG64 t = c->h[n]; *(md++) = (unsigned char)(t >> 56); *(md++) = (unsigned char)(t >> 48); *(md++) = (unsigned char)(t >> 40); *(md++) = (unsigned char)(t >> 32); *(md++) = (unsigned char)(t >> 24); *(md++) = (unsigned char)(t >> 16); *(md++) = (unsigned char)(t >> 8); *(md++) = (unsigned char)(t); } break; case SHA512_DIGEST_LENGTH: for (n = 0; n < SHA512_DIGEST_LENGTH / 8; n++) { SHA_LONG64 t = c->h[n]; *(md++) = (unsigned char)(t >> 56); *(md++) = (unsigned char)(t >> 48); *(md++) = (unsigned char)(t >> 40); *(md++) = (unsigned char)(t >> 32); *(md++) = (unsigned char)(t >> 24); *(md++) = (unsigned char)(t >> 16); *(md++) = (unsigned char)(t >> 8); *(md++) = (unsigned char)(t); } break; default: return 0; } return 1; } crypto/ec/curve25519.c:4623: error: INTEGER_OVERFLOW_L2 (128 - [113, 380]):unsigned64 by call to `SHA512_Final`. Showing all 14 steps of the trace crypto/ec/curve25519.c:4619:3: Call 4617. ge_p3_tobytes(out_sig, &R); 4618. 4619. SHA512_Init(&hash_ctx); ^ 4620. SHA512_Update(&hash_ctx, out_sig, 32); 4621. SHA512_Update(&hash_ctx, public_key, 32); crypto/sha/sha512.c:94:5: Assignment 92. c->Nl = 0; 93. c->Nh = 0; 94. c->num = 0; ^ 95. c->md_len = SHA512_DIGEST_LENGTH; 96. return 1; crypto/ec/curve25519.c:4620:3: Call 4618. 4619. SHA512_Init(&hash_ctx); 4620. SHA512_Update(&hash_ctx, out_sig, 32); ^ 4621. SHA512_Update(&hash_ctx, public_key, 32); 4622. SHA512_Update(&hash_ctx, message, message_len); crypto/sha/sha512.c:188:1: Parameter `c->num` 186. } 187. 188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) 189. { 190. SHA_LONG64 l; crypto/ec/curve25519.c:4621:3: Call 4619. SHA512_Init(&hash_ctx); 4620. SHA512_Update(&hash_ctx, out_sig, 32); 4621. SHA512_Update(&hash_ctx, public_key, 32); ^ 4622. SHA512_Update(&hash_ctx, message, message_len); 4623. SHA512_Final(hram, &hash_ctx); crypto/sha/sha512.c:188:1: Parameter `c->num` 186. } 187. 188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) 189. { 190. SHA_LONG64 l; crypto/ec/curve25519.c:4622:3: Call 4620. SHA512_Update(&hash_ctx, out_sig, 32); 4621. SHA512_Update(&hash_ctx, public_key, 32); 4622. SHA512_Update(&hash_ctx, message, message_len); ^ 4623. SHA512_Final(hram, &hash_ctx); 4624. crypto/sha/sha512.c:188:1: Parameter `c->num` 186. } 187. 188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) 189. { 190. SHA_LONG64 l; crypto/ec/curve25519.c:4623:3: Call 4621. SHA512_Update(&hash_ctx, public_key, 32); 4622. SHA512_Update(&hash_ctx, message, message_len); 4623. SHA512_Final(hram, &hash_ctx); ^ 4624. 4625. x25519_sc_reduce(hram); crypto/sha/sha512.c:104:1: <RHS trace> 102. void sha512_block_data_order(SHA512_CTX *ctx, const void *in, size_t num); 103. 104. > int SHA512_Final(unsigned char *md, SHA512_CTX *c) 105. { 106. unsigned char *p = (unsigned char *)c->u.p; crypto/sha/sha512.c:104:1: Parameter `c->num` 102. void sha512_block_data_order(SHA512_CTX *ctx, const void *in, size_t num); 103. 104. > int SHA512_Final(unsigned char *md, SHA512_CTX *c) 105. { 106. unsigned char *p = (unsigned char *)c->u.p; crypto/sha/sha512.c:107:5: Assignment 105. { 106. unsigned char *p = (unsigned char *)c->u.p; 107. size_t n = c->num; ^ 108. 109. p[n] = 0x80; /* There always is a room for one */ crypto/sha/sha512.c:110:5: Assignment 108. 109. p[n] = 0x80; /* There always is a room for one */ 110. n++; ^ 111. if (n > (sizeof(c->u) - 16)) { 112. memset(p + n, 0, sizeof(c->u) - n); crypto/sha/sha512.c:112:9: Binary operation: (128 - [113, 380]):unsigned64 by call to `SHA512_Final` 110. n++; 111. if (n > (sizeof(c->u) - 16)) { 112. memset(p + n, 0, sizeof(c->u) - n); ^ 113. n = 0; 114. sha512_block_data_order(c, p, 1);
https://github.com/openssl/openssl/blob/04dec1ab34df70c1588d42cc394e8fa8b5f3191c/crypto/sha/sha512.c/#L112
d2a_code_trace_data_45053
static void opt_output_file(const char *filename) { AVFormatContext *oc; int err, use_video, use_audio, use_subtitle; int input_has_video, input_has_audio, input_has_subtitle; AVFormatParameters params, *ap = &params; AVOutputFormat *file_oformat; if (!strcmp(filename, "-")) filename = "pipe:"; oc = avformat_alloc_context(); if (!oc) { print_error(filename, AVERROR(ENOMEM)); ffmpeg_exit(1); } if (last_asked_format) { file_oformat = av_guess_format(last_asked_format, NULL, NULL); if (!file_oformat) { fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); ffmpeg_exit(1); } last_asked_format = NULL; } else { file_oformat = av_guess_format(NULL, filename, NULL); if (!file_oformat) { fprintf(stderr, "Unable to find a suitable output format for '%s'\n", filename); ffmpeg_exit(1); } } oc->oformat = file_oformat; av_strlcpy(oc->filename, filename, sizeof(oc->filename)); if (!strcmp(file_oformat->name, "ffm") && av_strstart(filename, "http:", NULL)) { int err = read_ffserver_streams(oc, filename); if (err < 0) { print_error(filename, err); ffmpeg_exit(1); } } else { use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name; use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name; use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name; if (nb_input_files > 0) { check_audio_video_sub_inputs(&input_has_video, &input_has_audio, &input_has_subtitle); if (!input_has_video) use_video = 0; if (!input_has_audio) use_audio = 0; if (!input_has_subtitle) use_subtitle = 0; } if (audio_disable) use_audio = 0; if (video_disable) use_video = 0; if (subtitle_disable) use_subtitle = 0; if (use_video) new_video_stream(oc, nb_output_files); if (use_audio) new_audio_stream(oc, nb_output_files); if (use_subtitle) new_subtitle_stream(oc, nb_output_files); oc->timestamp = recording_timestamp; av_metadata_copy(&oc->metadata, metadata, 0); av_metadata_free(&metadata); } output_files[nb_output_files++] = oc; if (oc->oformat->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(oc->filename)) { print_error(oc->filename, AVERROR_NUMEXPECTED); ffmpeg_exit(1); } } if (!(oc->oformat->flags & AVFMT_NOFILE)) { if (!file_overwrite && (strchr(filename, ':') == NULL || filename[1] == ':' || av_strstart(filename, "file:", NULL))) { if (url_exist(filename)) { if (!using_stdin) { fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename); fflush(stderr); if (!read_yesno()) { fprintf(stderr, "Not overwriting - exiting\n"); ffmpeg_exit(1); } } else { fprintf(stderr,"File '%s' already exists. Exiting.\n", filename); ffmpeg_exit(1); } } } if ((err = url_fopen(&oc->pb, filename, URL_WRONLY)) < 0) { print_error(filename, err); ffmpeg_exit(1); } } memset(ap, 0, sizeof(*ap)); if (av_set_parameters(oc, ap) < 0) { fprintf(stderr, "%s: Invalid encoding parameters\n", oc->filename); ffmpeg_exit(1); } oc->preload= (int)(mux_preload*AV_TIME_BASE); oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE); oc->loop_output = loop_output; oc->flags |= AVFMT_FLAG_NONBLOCK; set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM, NULL); av_freep(&forced_key_frames); } ffmpeg.c:3736: error: Null Dereference pointer `oc` last assigned on line 3714 could be null and is dereferenced at line 3736, column 5. ffmpeg.c:3703:1: start of procedure opt_output_file() 3701. } 3702. 3703. static void opt_output_file(const char *filename) ^ 3704. { 3705. AVFormatContext *oc; ffmpeg.c:3708:5: 3706. int err, use_video, use_audio, use_subtitle; 3707. int input_has_video, input_has_audio, input_has_subtitle; 3708. AVFormatParameters params, *ap = &params; ^ 3709. AVOutputFormat *file_oformat; 3710. ffmpeg.c:3711:10: Taking false branch 3709. AVOutputFormat *file_oformat; 3710. 3711. if (!strcmp(filename, "-")) ^ 3712. filename = "pipe:"; 3713. ffmpeg.c:3714:5: 3712. filename = "pipe:"; 3713. 3714. oc = avformat_alloc_context(); ^ 3715. if (!oc) { 3716. print_error(filename, AVERROR(ENOMEM)); libavformat/options.c:82:1: start of procedure avformat_alloc_context() 80. } 81. 82. AVFormatContext *avformat_alloc_context(void) ^ 83. { 84. AVFormatContext *ic; libavformat/options.c:85:5: 83. { 84. AVFormatContext *ic; 85. ic = av_malloc(sizeof(AVFormatContext)); ^ 86. if (!ic) return ic; 87. avformat_get_context_defaults(ic); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(FF_INTERNAL_MEM_TYPE size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(FF_INTERNAL_MEM_TYPE size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,16,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:116:5: 114. ptr = malloc(size); 115. #endif 116. return ptr; ^ 117. } 118. 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, FF_INTERNAL_MEM_TYPE size) libavformat/options.c:86:10: Taking true branch 84. AVFormatContext *ic; 85. ic = av_malloc(sizeof(AVFormatContext)); 86. if (!ic) return ic; ^ 87. avformat_get_context_defaults(ic); 88. ic->av_class = &av_format_context_class; libavformat/options.c:86:14: 84. AVFormatContext *ic; 85. ic = av_malloc(sizeof(AVFormatContext)); 86. if (!ic) return ic; ^ 87. avformat_get_context_defaults(ic); 88. ic->av_class = &av_format_context_class; libavformat/options.c:90:1: return from a call to avformat_alloc_context 88. ic->av_class = &av_format_context_class; 89. return ic; 90. } ^ 91. 92. #if FF_API_ALLOC_FORMAT_CONTEXT ffmpeg.c:3715:10: Taking true branch 3713. 3714. oc = avformat_alloc_context(); 3715. if (!oc) { ^ 3716. print_error(filename, AVERROR(ENOMEM)); 3717. ffmpeg_exit(1); ffmpeg.c:3716:9: 3714. oc = avformat_alloc_context(); 3715. if (!oc) { 3716. print_error(filename, AVERROR(ENOMEM)); ^ 3717. ffmpeg_exit(1); 3718. } cmdutils.c:360:1: start of procedure print_error() 358. } 359. 360. void print_error(const char *filename, int err) ^ 361. { 362. char errbuf[128]; cmdutils.c:363:5: 361. { 362. char errbuf[128]; 363. const char *errbuf_ptr = errbuf; ^ 364. 365. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) cmdutils.c:365:9: Taking true branch 363. const char *errbuf_ptr = errbuf; 364. 365. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) ^ 366. errbuf_ptr = strerror(AVUNERROR(err)); 367. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); cmdutils.c:366:9: Skipping strerror(): method has no implementation 364. 365. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) 366. errbuf_ptr = strerror(AVUNERROR(err)); ^ 367. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); 368. } cmdutils.c:367:5: 365. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) 366. errbuf_ptr = strerror(AVUNERROR(err)); 367. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); ^ 368. } 369. cmdutils.c:368:1: return from a call to print_error 366. errbuf_ptr = strerror(AVUNERROR(err)); 367. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); 368. } ^ 369. 370. static int warned_cfg = 0; ffmpeg.c:3717:9: Skipping ffmpeg_exit(): empty list of specs 3715. if (!oc) { 3716. print_error(filename, AVERROR(ENOMEM)); 3717. ffmpeg_exit(1); ^ 3718. } 3719. ffmpeg.c:3720:9: Taking true branch 3718. } 3719. 3720. if (last_asked_format) { ^ 3721. file_oformat = av_guess_format(last_asked_format, NULL, NULL); 3722. if (!file_oformat) { ffmpeg.c:3721:9: Skipping av_guess_format(): empty list of specs 3719. 3720. if (last_asked_format) { 3721. file_oformat = av_guess_format(last_asked_format, NULL, NULL); ^ 3722. if (!file_oformat) { 3723. fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); ffmpeg.c:3722:14: Taking false branch 3720. if (last_asked_format) { 3721. file_oformat = av_guess_format(last_asked_format, NULL, NULL); 3722. if (!file_oformat) { ^ 3723. fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); 3724. ffmpeg_exit(1); ffmpeg.c:3726:9: 3724. ffmpeg_exit(1); 3725. } 3726. last_asked_format = NULL; ^ 3727. } else { 3728. file_oformat = av_guess_format(NULL, filename, NULL); ffmpeg.c:3736:5: 3734. } 3735. 3736. oc->oformat = file_oformat; ^ 3737. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3738.
https://github.com/libav/libav/blob/87e4d9b252bc6fa3b982f7050013069c9dc3e05b/ffmpeg.c/#L3736