id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_42754
static int describe_param_type(char *buf, size_t bufsz, const OSSL_PARAM *param) { const char *type_mod = ""; const char *type = NULL; int show_type_number = 0; int printed_len; switch (param->data_type) { case OSSL_PARAM_UNSIGNED_INTEGER: type_mod = "unsigned "; case OSSL_PARAM_INTEGER: type = "integer"; break; case OSSL_PARAM_UTF8_PTR: type_mod = "pointer to a "; case OSSL_PARAM_UTF8_STRING: type = "UTF8 encoded string"; break; case OSSL_PARAM_OCTET_PTR: type_mod = "pointer to an "; case OSSL_PARAM_OCTET_STRING: type = "octet string"; break; default: type = "unknown type"; show_type_number = 1; break; } printed_len = BIO_snprintf(buf, bufsz, "%s: ", param->key); if (printed_len > 0) { buf += printed_len; bufsz -= printed_len; } printed_len = BIO_snprintf(buf, bufsz, "%s%s", type_mod, type); if (printed_len > 0) { buf += printed_len; bufsz -= printed_len; } if (show_type_number) { printed_len = BIO_snprintf(buf, bufsz, " [%d]", param->data_type); if (printed_len > 0) { buf += printed_len; bufsz -= printed_len; } } if (param->data_size == 0) printed_len = BIO_snprintf(buf, bufsz, " (arbitrary size)"); else printed_len = BIO_snprintf(buf, bufsz, " (max %zu bytes large)", param->data_size); if (printed_len > 0) { buf += printed_len; bufsz -= printed_len; } *buf = '\0'; return 1; } apps/lib/app_params.c:90: error: BUFFER_OVERRUN_L2 Offset: [0, 8589934588] Size: 200 by call to `describe_param_type`. Showing all 5 steps of the trace apps/lib/app_params.c:75:1: Array declaration 73. } 74. 75. > int print_param_types(const char *thing, const OSSL_PARAM *pdefs, int indent) 76. { 77. if (pdefs == NULL) { apps/lib/app_params.c:90:13: Call 88. char buf[200]; /* This should be ample space */ 89. 90. describe_param_type(buf, sizeof(buf), pdefs); ^ 91. BIO_printf(bio_out, "%*s %s\n", indent, "", buf); 92. } apps/lib/app_params.c:13:1: <Length trace> 11. #include "app_params.h" 12. 13. > static int describe_param_type(char *buf, size_t bufsz, const OSSL_PARAM *param) 14. { 15. const char *type_mod = ""; apps/lib/app_params.c:13:1: Parameter `*buf` 11. #include "app_params.h" 12. 13. > static int describe_param_type(char *buf, size_t bufsz, const OSSL_PARAM *param) 14. { 15. const char *type_mod = ""; apps/lib/app_params.c:71:5: Array access: Offset: [0, 8589934588] Size: 200 by call to `describe_param_type` 69. bufsz -= printed_len; 70. } 71. *buf = '\0'; ^ 72. return 1; 73. }
https://github.com/openssl/openssl/blob/2d9007587c5072a513c84f22db7be55767b4c63d/apps/lib/app_params.c/#L71
d2a_code_trace_data_42755
int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, const unsigned char *md, int mdlen) { ASN1_OCTET_STRING *os; os = ASN1_OCTET_STRING_new(); if (os == NULL) return 0; if (!ASN1_STRING_set(os, md, mdlen) || !PKCS7_add_signed_attribute(si, NID_pkcs9_messageDigest, V_ASN1_OCTET_STRING, os)) { ASN1_OCTET_STRING_free(os); return 0; } return 1; } crypto/pkcs7/pk7_attr.c:162: error: MEMORY_LEAK memory dynamically allocated by call to `ASN1_OCTET_STRING_new()` at line 156, column 10 is not reachable after line 162, column 9. Showing all 99 steps of the trace crypto/pkcs7/pk7_attr.c:152:1: start of procedure PKCS7_add1_attrib_digest() 150. } 151. 152. > int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si, 153. const unsigned char *md, int mdlen) 154. { crypto/pkcs7/pk7_attr.c:156:5: 154. { 155. ASN1_OCTET_STRING *os; 156. > os = ASN1_OCTET_STRING_new(); 157. if (os == NULL) 158. return 0; crypto/asn1/tasn_typ.c:77:1: start of procedure ASN1_OCTET_STRING_new() 75. } 76. 77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING) 78. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER) 79. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED) crypto/asn1/asn1_lib.c:349:1: start of procedure ASN1_STRING_type_new() 347. } 348. 349. > ASN1_STRING *ASN1_STRING_type_new(int type) 350. { 351. ASN1_STRING *ret; crypto/asn1/asn1_lib.c:353:5: 351. ASN1_STRING *ret; 352. 353. > ret = OPENSSL_zalloc(sizeof(*ret)); 354. if (ret == NULL) { 355. ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE); 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/asn1/asn1_lib.c:354:9: Taking false branch 352. 353. ret = OPENSSL_zalloc(sizeof(*ret)); 354. if (ret == NULL) { ^ 355. ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE); 356. return (NULL); crypto/asn1/asn1_lib.c:358:5: 356. return (NULL); 357. } 358. > ret->type = type; 359. return (ret); 360. } crypto/asn1/asn1_lib.c:359:5: 357. } 358. ret->type = type; 359. > return (ret); 360. } 361. crypto/asn1/asn1_lib.c:360:1: return from a call to ASN1_STRING_type_new 358. ret->type = type; 359. return (ret); 360. > } 361. 362. void ASN1_STRING_free(ASN1_STRING *a) crypto/asn1/tasn_typ.c:77:1: return from a call to ASN1_OCTET_STRING_new 75. } 76. 77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING) 78. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER) 79. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED) crypto/pkcs7/pk7_attr.c:157:9: Taking false branch 155. ASN1_OCTET_STRING *os; 156. os = ASN1_OCTET_STRING_new(); 157. if (os == NULL) ^ 158. return 0; 159. if (!ASN1_STRING_set(os, md, mdlen) crypto/pkcs7/pk7_attr.c:159:10: 157. if (os == NULL) 158. return 0; 159. > if (!ASN1_STRING_set(os, md, mdlen) 160. || !PKCS7_add_signed_attribute(si, NID_pkcs9_messageDigest, 161. V_ASN1_OCTET_STRING, os)) { crypto/asn1/asn1_lib.c:308:1: start of procedure ASN1_STRING_set() 306. } 307. 308. > int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) 309. { 310. unsigned char *c; crypto/asn1/asn1_lib.c:311:5: 309. { 310. unsigned char *c; 311. > const char *data = _data; 312. 313. if (len < 0) { crypto/asn1/asn1_lib.c:313:9: Taking false branch 311. const char *data = _data; 312. 313. if (len < 0) { ^ 314. if (data == NULL) 315. return (0); crypto/asn1/asn1_lib.c:319:10: Taking true branch 317. len = strlen(data); 318. } 319. if ((str->length < len) || (str->data == NULL)) { ^ 320. c = str->data; 321. str->data = OPENSSL_realloc(c, len + 1); crypto/asn1/asn1_lib.c:320:9: 318. } 319. if ((str->length < len) || (str->data == NULL)) { 320. > c = str->data; 321. str->data = OPENSSL_realloc(c, len + 1); 322. if (str->data == NULL) { crypto/asn1/asn1_lib.c:321:9: 319. if ((str->length < len) || (str->data == NULL)) { 320. c = str->data; 321. > str->data = OPENSSL_realloc(c, len + 1); 322. if (str->data == NULL) { 323. ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE); 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 false 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:171:9: Taking false branch 169. return CRYPTO_malloc(num, file, line); 170. 171. if (num == 0) { ^ 172. CRYPTO_free(str); 173. return NULL; crypto/mem.c:176:5: 174. } 175. 176. > allow_customize = 0; 177. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 178. if (call_malloc_debug) { crypto/mem.c:186:5: 184. } 185. #else 186. > (void)file; 187. (void)line; 188. #endif crypto/mem.c:187:5: 185. #else 186. (void)file; 187. > (void)line; 188. #endif 189. return realloc(str, num); crypto/mem.c:189:5: 187. (void)line; 188. #endif 189. > return realloc(str, num); 190. 191. } 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/asn1/asn1_lib.c:322:13: Taking false branch 320. c = str->data; 321. str->data = OPENSSL_realloc(c, len + 1); 322. if (str->data == NULL) { ^ 323. ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE); 324. str->data = c; crypto/asn1/asn1_lib.c:328:5: 326. } 327. } 328. > str->length = len; 329. if (data != NULL) { 330. memcpy(str->data, data, len); crypto/asn1/asn1_lib.c:329:9: Taking true branch 327. } 328. str->length = len; 329. if (data != NULL) { ^ 330. memcpy(str->data, data, len); 331. /* an allowance for strings :-) */ crypto/asn1/asn1_lib.c:330:9: 328. str->length = len; 329. if (data != NULL) { 330. > memcpy(str->data, data, len); 331. /* an allowance for strings :-) */ 332. str->data[len] = '\0'; crypto/asn1/asn1_lib.c:332:9: 330. memcpy(str->data, data, len); 331. /* an allowance for strings :-) */ 332. > str->data[len] = '\0'; 333. } 334. return (1); crypto/asn1/asn1_lib.c:334:5: 332. str->data[len] = '\0'; 333. } 334. > return (1); 335. } 336. crypto/asn1/asn1_lib.c:335:1: return from a call to ASN1_STRING_set 333. } 334. return (1); 335. > } 336. 337. void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) crypto/pkcs7/pk7_attr.c:159:10: Taking false branch 157. if (os == NULL) 158. return 0; 159. if (!ASN1_STRING_set(os, md, mdlen) ^ 160. || !PKCS7_add_signed_attribute(si, NID_pkcs9_messageDigest, 161. V_ASN1_OCTET_STRING, os)) { crypto/pkcs7/pk7_attr.c:160:13: 158. return 0; 159. if (!ASN1_STRING_set(os, md, mdlen) 160. > || !PKCS7_add_signed_attribute(si, NID_pkcs9_messageDigest, 161. V_ASN1_OCTET_STRING, os)) { 162. ASN1_OCTET_STRING_free(os); crypto/pkcs7/pk7_doit.c:1177:1: start of procedure PKCS7_add_signed_attribute() 1175. } 1176. 1177. > int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, 1178. void *value) 1179. { crypto/pkcs7/pk7_doit.c:1180:5: 1178. void *value) 1179. { 1180. > return (add_attribute(&(p7si->auth_attr), nid, atrtype, value)); 1181. } 1182. crypto/pkcs7/pk7_doit.c:1189:1: start of procedure add_attribute() 1187. } 1188. 1189. > static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, 1190. void *value) 1191. { crypto/pkcs7/pk7_doit.c:1192:5: 1190. void *value) 1191. { 1192. > X509_ATTRIBUTE *attr = NULL; 1193. 1194. if (*sk == NULL) { crypto/pkcs7/pk7_doit.c:1194:9: Taking true branch 1192. X509_ATTRIBUTE *attr = NULL; 1193. 1194. if (*sk == NULL) { ^ 1195. if ((*sk = sk_X509_ATTRIBUTE_new_null()) == NULL) 1196. return 0; crypto/pkcs7/pk7_doit.c:1195:13: 1193. 1194. if (*sk == NULL) { 1195. > if ((*sk = sk_X509_ATTRIBUTE_new_null()) == NULL) 1196. return 0; 1197. new_attrib: include/openssl/x509.h:160:1: start of procedure sk_X509_ATTRIBUTE_new_null() 158. typedef struct x509_attributes_st X509_ATTRIBUTE; 159. 160. > DEFINE_STACK_OF(X509_ATTRIBUTE) 161. 162. typedef struct X509_req_info_st X509_REQ_INFO; crypto/stack/stack.c:145:1: start of procedure sk_new_null() 143. } 144. 145. > _STACK *sk_new_null(void) 146. { 147. return sk_new((int (*)(const void *, const void *))0); crypto/stack/stack.c:147:5: 145. _STACK *sk_new_null(void) 146. { 147. > return sk_new((int (*)(const void *, const void *))0); 148. } 149. crypto/stack/stack.c:150:1: start of procedure sk_new() 148. } 149. 150. > _STACK *sk_new(int (*c) (const void *, const void *)) 151. { 152. _STACK *ret; crypto/stack/stack.c:154:9: 152. _STACK *ret; 153. 154. > if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == 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 false 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: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/stack/stack.c:154:9: Taking true branch 152. _STACK *ret; 153. 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) ^ 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/stack/stack.c:162:2: 160. return (ret); 161. 162. > err: 163. OPENSSL_free(ret); 164. return (NULL); crypto/stack/stack.c:163:5: 161. 162. err: 163. > OPENSSL_free(ret); 164. return (NULL); 165. } 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) crypto/stack/stack.c:164:5: 162. err: 163. OPENSSL_free(ret); 164. > return (NULL); 165. } 166. crypto/stack/stack.c:165:1: return from a call to sk_new 163. OPENSSL_free(ret); 164. return (NULL); 165. > } 166. 167. int sk_insert(_STACK *st, void *data, int loc) crypto/stack/stack.c:148:1: return from a call to sk_new_null 146. { 147. return sk_new((int (*)(const void *, const void *))0); 148. > } 149. 150. _STACK *sk_new(int (*c) (const void *, const void *)) include/openssl/x509.h:160:1: return from a call to sk_X509_ATTRIBUTE_new_null 158. typedef struct x509_attributes_st X509_ATTRIBUTE; 159. 160. > DEFINE_STACK_OF(X509_ATTRIBUTE) 161. 162. typedef struct X509_req_info_st X509_REQ_INFO; crypto/pkcs7/pk7_doit.c:1195:13: Taking true branch 1193. 1194. if (*sk == NULL) { 1195. if ((*sk = sk_X509_ATTRIBUTE_new_null()) == NULL) ^ 1196. return 0; 1197. new_attrib: crypto/pkcs7/pk7_doit.c:1196:13: 1194. if (*sk == NULL) { 1195. if ((*sk = sk_X509_ATTRIBUTE_new_null()) == NULL) 1196. > return 0; 1197. new_attrib: 1198. if ((attr = X509_ATTRIBUTE_create(nid, atrtype, value)) == NULL) crypto/pkcs7/pk7_doit.c:1225:1: return from a call to add_attribute 1223. end: 1224. return (1); 1225. > } crypto/pkcs7/pk7_doit.c:1181:1: return from a call to PKCS7_add_signed_attribute 1179. { 1180. return (add_attribute(&(p7si->auth_attr), nid, atrtype, value)); 1181. > } 1182. 1183. int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype, crypto/pkcs7/pk7_attr.c:160:13: Taking true branch 158. return 0; 159. if (!ASN1_STRING_set(os, md, mdlen) 160. || !PKCS7_add_signed_attribute(si, NID_pkcs9_messageDigest, ^ 161. V_ASN1_OCTET_STRING, os)) { 162. ASN1_OCTET_STRING_free(os); crypto/pkcs7/pk7_attr.c:162:9: 160. || !PKCS7_add_signed_attribute(si, NID_pkcs9_messageDigest, 161. V_ASN1_OCTET_STRING, os)) { 162. > ASN1_OCTET_STRING_free(os); 163. return 0; 164. } crypto/asn1/tasn_typ.c:77:1: start of procedure ASN1_OCTET_STRING_free() 75. } 76. 77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING) 78. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER) 79. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED) crypto/asn1/asn1_lib.c:362:1: start of procedure ASN1_STRING_free() 360. } 361. 362. > void ASN1_STRING_free(ASN1_STRING *a) 363. { 364. if (a == NULL) crypto/asn1/asn1_lib.c:364:9: Taking false branch 362. void ASN1_STRING_free(ASN1_STRING *a) 363. { 364. if (a == NULL) ^ 365. return; 366. if (!(a->flags & ASN1_STRING_FLAG_NDEF)) crypto/asn1/asn1_lib.c:366:11: Taking false branch 364. if (a == NULL) 365. return; 366. if (!(a->flags & ASN1_STRING_FLAG_NDEF)) ^ 367. OPENSSL_free(a->data); 368. if (!(a->flags & ASN1_STRING_FLAG_EMBED)) crypto/asn1/asn1_lib.c:368:11: Taking false branch 366. if (!(a->flags & ASN1_STRING_FLAG_NDEF)) 367. OPENSSL_free(a->data); 368. if (!(a->flags & ASN1_STRING_FLAG_EMBED)) ^ 369. OPENSSL_free(a); 370. } crypto/asn1/asn1_lib.c:368:5: 366. if (!(a->flags & ASN1_STRING_FLAG_NDEF)) 367. OPENSSL_free(a->data); 368. > if (!(a->flags & ASN1_STRING_FLAG_EMBED)) 369. OPENSSL_free(a); 370. } crypto/asn1/asn1_lib.c:370:1: return from a call to ASN1_STRING_free 368. if (!(a->flags & ASN1_STRING_FLAG_EMBED)) 369. OPENSSL_free(a); 370. > } 371. 372. void ASN1_STRING_clear_free(ASN1_STRING *a) crypto/asn1/tasn_typ.c:77:1: return from a call to ASN1_OCTET_STRING_free 75. } 76. 77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING) 78. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER) 79. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/pkcs7/pk7_attr.c/#L162
d2a_code_trace_data_42756
int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file) { int ret = 0; char *enabled_logs; CTLOG_STORE_LOAD_CTX* load_ctx = ctlog_store_load_ctx_new(); load_ctx->log_store = store; load_ctx->conf = NCONF_new(NULL); if (load_ctx->conf == NULL) goto end; if (NCONF_load(load_ctx->conf, file, NULL) <= 0) { CTerr(CT_F_CTLOG_STORE_LOAD_FILE, CT_R_LOG_CONF_INVALID); goto end; } enabled_logs = NCONF_get_string(load_ctx->conf, NULL, "enabled_logs"); if (enabled_logs == NULL) { CTerr(CT_F_CTLOG_STORE_LOAD_FILE, CT_R_LOG_CONF_INVALID); goto end; } if (!CONF_parse_list(enabled_logs, ',', 1, ctlog_store_load_log, load_ctx) || load_ctx->invalid_log_entries > 0) { CTerr(CT_F_CTLOG_STORE_LOAD_FILE, CT_R_LOG_CONF_INVALID); goto end; } ret = 1; end: NCONF_free(load_ctx->conf); ctlog_store_load_ctx_free(load_ctx); return ret; } crypto/ct/ct_log.c:201: error: NULL_DEREFERENCE pointer `load_ctx` last assigned on line 199 could be null and is dereferenced at line 201, column 5. Showing all 25 steps of the trace crypto/ct/ct_log.c:195:1: start of procedure CTLOG_STORE_load_file() 193. } 194. 195. > int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file) 196. { 197. int ret = 0; crypto/ct/ct_log.c:197:5: 195. int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file) 196. { 197. > int ret = 0; 198. char *enabled_logs; 199. CTLOG_STORE_LOAD_CTX* load_ctx = ctlog_store_load_ctx_new(); crypto/ct/ct_log.c:199:5: 197. int ret = 0; 198. char *enabled_logs; 199. > CTLOG_STORE_LOAD_CTX* load_ctx = ctlog_store_load_ctx_new(); 200. 201. load_ctx->log_store = store; crypto/ct/ct_log.c:57:1: start of procedure ctlog_store_load_ctx_new() 55. static void ctlog_store_load_ctx_free(CTLOG_STORE_LOAD_CTX* ctx); 56. 57. > static CTLOG_STORE_LOAD_CTX *ctlog_store_load_ctx_new() 58. { 59. CTLOG_STORE_LOAD_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); crypto/ct/ct_log.c:59:5: 57. static CTLOG_STORE_LOAD_CTX *ctlog_store_load_ctx_new() 58. { 59. > CTLOG_STORE_LOAD_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); 60. 61. if (ctx == NULL) crypto/mem.c:98:1: start of procedure CRYPTO_zalloc() 96. } 97. 98. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:100:5: 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. > void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) crypto/mem.c:71:1: start of procedure CRYPTO_malloc() 69. } 70. 71. > void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. void *ret = NULL; crypto/mem.c:73:5: 71. void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. > void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:75:9: Taking false branch 73. void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 76. return malloc_impl(num, file, line); 77. crypto/mem.c:78:9: Taking false branch 76. return malloc_impl(num, file, line); 77. 78. if (num <= 0) ^ 79. return NULL; 80. crypto/mem.c:81:5: 79. return NULL; 80. 81. > allow_customize = 0; 82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 83. if (call_malloc_debug) { crypto/mem.c:91:5: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:91:24: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:92:5: 90. #else 91. osslargused(file); osslargused(line); 92. > ret = malloc(num); 93. #endif 94. crypto/mem.c:95:5: 93. #endif 94. 95. > return ret; 96. } 97. crypto/mem.c:96:1: return from a call to CRYPTO_malloc 94. 95. return ret; 96. > } 97. 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:102:9: Taking false branch 100. void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) ^ 103. memset(ret, 0, num); 104. return ret; crypto/mem.c:104:5: 102. if (ret != NULL) 103. memset(ret, 0, num); 104. > return ret; 105. } 106. crypto/mem.c:105:1: return from a call to CRYPTO_zalloc 103. memset(ret, 0, num); 104. return ret; 105. > } 106. 107. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/ct/ct_log.c:61:9: Taking true branch 59. CTLOG_STORE_LOAD_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); 60. 61. if (ctx == NULL) ^ 62. CTerr(CT_F_CTLOG_STORE_LOAD_CTX_NEW, ERR_R_MALLOC_FAILURE); 63. crypto/ct/ct_log.c:62:9: Skipping ERR_put_error(): empty list of specs 60. 61. if (ctx == NULL) 62. CTerr(CT_F_CTLOG_STORE_LOAD_CTX_NEW, ERR_R_MALLOC_FAILURE); ^ 63. 64. return ctx; crypto/ct/ct_log.c:64:5: 62. CTerr(CT_F_CTLOG_STORE_LOAD_CTX_NEW, ERR_R_MALLOC_FAILURE); 63. 64. > return ctx; 65. } 66. crypto/ct/ct_log.c:65:1: return from a call to ctlog_store_load_ctx_new 63. 64. return ctx; 65. > } 66. 67. static void ctlog_store_load_ctx_free(CTLOG_STORE_LOAD_CTX* ctx) crypto/ct/ct_log.c:201:5: 199. CTLOG_STORE_LOAD_CTX* load_ctx = ctlog_store_load_ctx_new(); 200. 201. > load_ctx->log_store = store; 202. load_ctx->conf = NCONF_new(NULL); 203. if (load_ctx->conf == NULL)
https://github.com/openssl/openssl/blob/b2de11c58b57e7f0d58c6f8a1d4177705650647e/crypto/ct/ct_log.c/#L201
d2a_code_trace_data_42757
void engine_cleanup_add_last(ENGINE_CLEANUP_CB *cb) { ENGINE_CLEANUP_ITEM *item; if (!int_cleanup_check(1)) return; item = int_cleanup_item(cb); if (item) sk_ENGINE_CLEANUP_ITEM_push(cleanup_stack, item); } crypto/engine/eng_lib.c:189: error: MEMORY_LEAK memory dynamically allocated by call to `int_cleanup_item()` at line 187, column 12 is not reachable after line 189, column 9. Showing all 46 steps of the trace crypto/engine/eng_lib.c:182:1: start of procedure engine_cleanup_add_last() 180. } 181. 182. > void engine_cleanup_add_last(ENGINE_CLEANUP_CB *cb) 183. { 184. ENGINE_CLEANUP_ITEM *item; crypto/engine/eng_lib.c:185:10: 183. { 184. ENGINE_CLEANUP_ITEM *item; 185. > if (!int_cleanup_check(1)) 186. return; 187. item = int_cleanup_item(cb); crypto/engine/eng_lib.c:153:1: start of procedure int_cleanup_check() 151. */ 152. static STACK_OF(ENGINE_CLEANUP_ITEM) *cleanup_stack = NULL; 153. > static int int_cleanup_check(int create) 154. { 155. if (cleanup_stack) crypto/engine/eng_lib.c:155:9: Taking true branch 153. static int int_cleanup_check(int create) 154. { 155. if (cleanup_stack) ^ 156. return 1; 157. if (!create) crypto/engine/eng_lib.c:156:9: 154. { 155. if (cleanup_stack) 156. > return 1; 157. if (!create) 158. return 0; crypto/engine/eng_lib.c:161:1: return from a call to int_cleanup_check 159. cleanup_stack = sk_ENGINE_CLEANUP_ITEM_new_null(); 160. return (cleanup_stack ? 1 : 0); 161. > } 162. 163. static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb) crypto/engine/eng_lib.c:185:10: Taking false branch 183. { 184. ENGINE_CLEANUP_ITEM *item; 185. if (!int_cleanup_check(1)) ^ 186. return; 187. item = int_cleanup_item(cb); crypto/engine/eng_lib.c:187:5: 185. if (!int_cleanup_check(1)) 186. return; 187. > item = int_cleanup_item(cb); 188. if (item) 189. sk_ENGINE_CLEANUP_ITEM_push(cleanup_stack, item); crypto/engine/eng_lib.c:163:1: start of procedure int_cleanup_item() 161. } 162. 163. > static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb) 164. { 165. ENGINE_CLEANUP_ITEM *item = OPENSSL_malloc(sizeof(*item)); crypto/engine/eng_lib.c:165:5: 163. static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb) 164. { 165. > ENGINE_CLEANUP_ITEM *item = OPENSSL_malloc(sizeof(*item)); 166. if (item == NULL) 167. return 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/engine/eng_lib.c:166:9: Taking false branch 164. { 165. ENGINE_CLEANUP_ITEM *item = OPENSSL_malloc(sizeof(*item)); 166. if (item == NULL) ^ 167. return NULL; 168. item->cb = cb; crypto/engine/eng_lib.c:168:5: 166. if (item == NULL) 167. return NULL; 168. > item->cb = cb; 169. return item; 170. } crypto/engine/eng_lib.c:169:5: 167. return NULL; 168. item->cb = cb; 169. > return item; 170. } 171. crypto/engine/eng_lib.c:170:1: return from a call to int_cleanup_item 168. item->cb = cb; 169. return item; 170. > } 171. 172. void engine_cleanup_add_first(ENGINE_CLEANUP_CB *cb) crypto/engine/eng_lib.c:188:9: Taking true branch 186. return; 187. item = int_cleanup_item(cb); 188. if (item) ^ 189. sk_ENGINE_CLEANUP_ITEM_push(cleanup_stack, item); 190. } crypto/engine/eng_lib.c:189:9: 187. item = int_cleanup_item(cb); 188. if (item) 189. > sk_ENGINE_CLEANUP_ITEM_push(cleanup_stack, item); 190. } 191. crypto/engine/eng_int.h:109:1: start of procedure sk_ENGINE_CLEANUP_ITEM_push() 107. ENGINE_CLEANUP_CB *cb; 108. } ENGINE_CLEANUP_ITEM; 109. > DEFINE_STACK_OF(ENGINE_CLEANUP_ITEM) 110. void engine_cleanup_add_first(ENGINE_CLEANUP_CB *cb); 111. void engine_cleanup_add_last(ENGINE_CLEANUP_CB *cb); 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) crypto/engine/eng_int.h:109:1: return from a call to sk_ENGINE_CLEANUP_ITEM_push 107. ENGINE_CLEANUP_CB *cb; 108. } ENGINE_CLEANUP_ITEM; 109. > DEFINE_STACK_OF(ENGINE_CLEANUP_ITEM) 110. void engine_cleanup_add_first(ENGINE_CLEANUP_CB *cb); 111. void engine_cleanup_add_last(ENGINE_CLEANUP_CB *cb);
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/engine/eng_lib.c/#L189
d2a_code_trace_data_42758
static void execute_decode_slices(H264Context *h, int context_count){ MpegEncContext * const s = &h->s; AVCodecContext * const avctx= s->avctx; H264Context *hx; int i; if(context_count == 1) { decode_slice(avctx, h); } else { for(i = 1; i < context_count; i++) { hx = h->thread_context[i]; hx->s.error_resilience = avctx->error_resilience; hx->s.error_count = 0; } avctx->execute(avctx, (void *)decode_slice, (void **)h->thread_context, NULL, context_count); hx = h->thread_context[context_count - 1]; s->mb_x = hx->s.mb_x; s->mb_y = hx->s.mb_y; s->dropable = hx->s.dropable; s->picture_structure = hx->s.picture_structure; for(i = 1; i < context_count; i++) h->s.error_count += h->thread_context[i]->s.error_count; } } libavcodec/h264.c:7592: error: Buffer Overrun L3 Offset: [-1, +oo] Size: 8 by call to `execute_decode_slices`. libavcodec/h264.c:7434:5: Assignment 7432. int buf_index=0; 7433. H264Context *hx; ///< thread context 7434. int context_count = 0; ^ 7435. 7436. h->max_contexts = avctx->thread_count; libavcodec/h264.c:7592:13: Call 7590. 7591. if(context_count == h->max_contexts) { 7592. execute_decode_slices(h, context_count); ^ 7593. context_count = 0; 7594. } libavcodec/h264.c:7399:1: <Offset trace> 7397. * @param context_count number of contexts to execute 7398. */ 7399. static void execute_decode_slices(H264Context *h, int context_count){ ^ 7400. MpegEncContext * const s = &h->s; 7401. AVCodecContext * const avctx= s->avctx; libavcodec/h264.c:7399:1: Parameter `context_count` 7397. * @param context_count number of contexts to execute 7398. */ 7399. static void execute_decode_slices(H264Context *h, int context_count){ ^ 7400. MpegEncContext * const s = &h->s; 7401. AVCodecContext * const avctx= s->avctx; libavcodec/h264.c:7399:1: <Length trace> 7397. * @param context_count number of contexts to execute 7398. */ 7399. static void execute_decode_slices(H264Context *h, int context_count){ ^ 7400. MpegEncContext * const s = &h->s; 7401. AVCodecContext * const avctx= s->avctx; libavcodec/h264.c:7399:1: Parameter `h->thread_context[*]` 7397. * @param context_count number of contexts to execute 7398. */ 7399. static void execute_decode_slices(H264Context *h, int context_count){ ^ 7400. MpegEncContext * const s = &h->s; 7401. AVCodecContext * const avctx= s->avctx; libavcodec/h264.c:7418:14: Array access: Offset: [-1, +oo] Size: 8 by call to `execute_decode_slices` 7416. 7417. /* pull back stuff from slices to master context */ 7418. hx = h->thread_context[context_count - 1]; ^ 7419. s->mb_x = hx->s.mb_x; 7420. s->mb_y = hx->s.mb_y;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L7418
d2a_code_trace_data_42759
void ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) { ngx_connection_t *c; ngx_http_request_t *pr; ngx_http_core_loc_conf_t *clcf; c = r->connection; ngx_log_debug5(NGX_LOG_DEBUG_HTTP, c->log, 0, "http finalize request: %d, \"%V?%V\" a:%d, c:%d", rc, &r->uri, &r->args, r == c->data, r->main->count); if (rc == NGX_DONE) { ngx_http_finalize_connection(r); return; } if (rc == NGX_OK && r->filter_finalize) { c->error = 1; } if (rc == NGX_DECLINED) { r->content_handler = NULL; r->write_event_handler = ngx_http_core_run_phases; ngx_http_core_run_phases(r); return; } if (r != r->main && r->post_subrequest) { rc = r->post_subrequest->handler(r, r->post_subrequest->data, rc); } if (rc == NGX_ERROR || rc == NGX_HTTP_REQUEST_TIME_OUT || rc == NGX_HTTP_CLIENT_CLOSED_REQUEST || c->error) { if (ngx_http_post_action(r) == NGX_OK) { return; } if (r->main->blocked) { r->write_event_handler = ngx_http_request_finalizer; } ngx_http_terminate_request(r, rc); return; } if (rc >= NGX_HTTP_SPECIAL_RESPONSE || rc == NGX_HTTP_CREATED || rc == NGX_HTTP_NO_CONTENT) { if (rc == NGX_HTTP_CLOSE) { ngx_http_terminate_request(r, rc); return; } if (r == r->main) { if (c->read->timer_set) { ngx_del_timer(c->read); } if (c->write->timer_set) { ngx_del_timer(c->write); } } c->read->handler = ngx_http_request_handler; c->write->handler = ngx_http_request_handler; ngx_http_finalize_request(r, ngx_http_special_response_handler(r, rc)); return; } if (r != r->main) { if (r->buffered || r->postponed) { if (ngx_http_set_write_handler(r) != NGX_OK) { ngx_http_terminate_request(r, 0); } return; } pr = r->parent; if (r == c->data) { r->main->count--; if (!r->logged) { clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); if (clcf->log_subrequest) { ngx_http_log_request(r); } r->logged = 1; } else { ngx_log_error(NGX_LOG_ALERT, c->log, 0, "subrequest: \"%V?%V\" logged again", &r->uri, &r->args); } r->done = 1; if (pr->postponed && pr->postponed->request == r) { pr->postponed = pr->postponed->next; } c->data = pr; } else { ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, "http finalize non-active request: \"%V?%V\"", &r->uri, &r->args); r->write_event_handler = ngx_http_request_finalizer; if (r->waited) { r->done = 1; } } if (ngx_http_post_request(pr, NULL) != NGX_OK) { r->main->count++; ngx_http_terminate_request(r, 0); return; } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, "http wake parent request: \"%V?%V\"", &pr->uri, &pr->args); return; } if (r->buffered || c->buffered || r->postponed || r->blocked) { if (ngx_http_set_write_handler(r) != NGX_OK) { ngx_http_terminate_request(r, 0); } return; } if (r != c->data) { ngx_log_error(NGX_LOG_ALERT, c->log, 0, "http finalize non-active request: \"%V?%V\"", &r->uri, &r->args); return; } r->done = 1; r->write_event_handler = ngx_http_request_empty_handler; if (!r->post_action) { r->request_complete = 1; } if (ngx_http_post_action(r) == NGX_OK) { return; } if (c->read->timer_set) { ngx_del_timer(c->read); } if (c->write->timer_set) { c->write->delayed = 0; ngx_del_timer(c->write); } if (c->read->eof) { ngx_http_close_request(r, 0); return; } ngx_http_finalize_connection(r); } src/http/ngx_http_upstream.c:1020: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `ngx_http_upstream_finalize_request`. src/http/ngx_http_upstream.c:1015:9: Call 1013. 1014. if (ctx->state) { 1015. ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, ^ 1016. "%V could not be resolved (%i: %s)", 1017. &ctx->name, ctx->state, src/core/ngx_log.c:95:1: Parameter `log->next->disk_full_time` 93. #if (NGX_HAVE_VARIADIC_MACROS) 94. 95. void ^ 96. ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, 97. const char *fmt, ...) src/http/ngx_http_upstream.c:1020:9: Call 1018. ngx_resolver_strerror(ctx->state)); 1019. 1020. ngx_http_upstream_finalize_request(r, u, NGX_HTTP_BAD_GATEWAY); ^ 1021. goto failed; 1022. } src/http/ngx_http_upstream.c:3923:1: Parameter `r->main->count` 3921. 3922. 3923. static void ^ 3924. ngx_http_upstream_finalize_request(ngx_http_request_t *r, 3925. ngx_http_upstream_t *u, ngx_int_t rc) src/http/ngx_http_upstream.c:3934:9: Call 3932. if (u->cleanup == NULL) { 3933. /* the request was already finalized */ 3934. ngx_http_finalize_request(r, NGX_DONE); ^ 3935. return; 3936. } src/http/ngx_http_request.c:2249:1: <LHS trace> 2247. 2248. 2249. void ^ 2250. ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) 2251. { src/http/ngx_http_request.c:2249:1: Parameter `r->main->count` 2247. 2248. 2249. void ^ 2250. ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) 2251. { src/http/ngx_http_request.c:2340:13: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ngx_http_upstream_finalize_request` 2338. if (r == c->data) { 2339. 2340. r->main->count--; ^ 2341. 2342. if (!r->logged) {
https://github.com/nginx/nginx/blob/0d3b15729ce1340098f098a1e3342f13183fdde2/src/http/ngx_http_request.c/#L2340
d2a_code_trace_data_42760
const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){ int i; assert(p<=end); if(p>=end) return end; for(i=0; i<3; i++){ uint32_t tmp= *state << 8; *state= tmp + *(p++); if(tmp == 0x100 || p==end) return p; } while(p<end){ if (p[-1] > 1 ) p+= 3; else if(p[-2] ) p+= 2; else if(p[-3]|(p[-1]-1)) p++; else{ p++; break; } } p= FFMIN(p, end)-4; *state= AV_RB32(p); return p+4; } libavcodec/mpeg12.c:2305: error: Integer Overflow L1 ([1099511627520, +oo] + [0, +oo]):unsigned32 by call to `ff_find_start_code`. libavcodec/mpeg12.c:2292:1: Parameter `*buf` 2290. } 2291. 2292. static int decode_chunks(AVCodecContext *avctx, ^ 2293. AVFrame *picture, int *data_size, 2294. const uint8_t *buf, int buf_size) libavcodec/mpeg12.c:2305:19: Call 2303. /* find start next code */ 2304. uint32_t start_code = -1; 2305. buf_ptr = ff_find_start_code(buf_ptr,buf_end, &start_code); ^ 2306. if (start_code > 0x1ff){ 2307. if(s2->pict_type != FF_B_TYPE || avctx->skip_frame <= AVDISCARD_DEFAULT){ libavcodec/mpegvideo.c:82:1: <LHS trace> 80. 81. 82. const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){ ^ 83. int i; 84. libavcodec/mpegvideo.c:82:1: Parameter `*state` 80. 81. 82. const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){ ^ 83. int i; 84. libavcodec/mpegvideo.c:90:9: Assignment 88. 89. for(i=0; i<3; i++){ 90. uint32_t tmp= *state << 8; ^ 91. *state= tmp + *(p++); 92. if(tmp == 0x100 || p==end) libavcodec/mpegvideo.c:82:1: <RHS trace> 80. 81. 82. const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){ ^ 83. int i; 84. libavcodec/mpegvideo.c:82:1: Parameter `*p` 80. 81. 82. const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){ ^ 83. int i; 84. libavcodec/mpegvideo.c:91:9: Binary operation: ([1099511627520, +oo] + [0, +oo]):unsigned32 by call to `ff_find_start_code` 89. for(i=0; i<3; i++){ 90. uint32_t tmp= *state << 8; 91. *state= tmp + *(p++); ^ 92. if(tmp == 0x100 || p==end) 93. return p;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo.c/#L91
d2a_code_trace_data_42761
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/mpegvideo.c:1104: error: Integer Overflow L2 ([1, 2147483616] + 32):signed32 by call to `alloc_picture`. libavcodec/mpegvideo.c:1104:9: Call 1102. pic->f->coded_picture_number = s->coded_picture_number++; 1103. 1104. if (alloc_picture(s, pic, 0) < 0) ^ 1105. return -1; 1106. libavcodec/mpegvideo.c:318:1: Parameter `pic->f->nb_samples` 316. } 317. 318. static int alloc_picture(MpegEncContext *s, Picture *pic, int shared) ^ 319. { 320. return ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, shared, 0, libavcodec/mpegvideo.c:320:12: Call 318. static int alloc_picture(MpegEncContext *s, Picture *pic, int shared) 319. { 320. return ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, shared, 0, ^ 321. s->chroma_x_shift, s->chroma_y_shift, s->out_format, 322. s->mb_stride, s->mb_height, s->b8_stride, libavcodec/mpegpicture.c:211:1: Parameter `pic->f->nb_samples` 209. * The pixels are allocated/set by calling get_buffer() if shared = 0 210. */ 211. int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, ^ 212. ScratchpadContext *sc, int shared, int encoding, 213. int chroma_x_shift, int chroma_y_shift, int out_format, libavcodec/mpegpicture.c:224:13: Call 222. } else { 223. assert(!pic->f->buf[0]); 224. if (alloc_frame_buffer(avctx, pic, me, sc, ^ 225. chroma_x_shift, chroma_y_shift, 226. *linesize, *uvlinesize) < 0) libavcodec/mpegpicture.c:85:1: Parameter `pic->f->nb_samples` 83. * Allocate a frame buffer 84. */ 85. static int alloc_frame_buffer(AVCodecContext *avctx, Picture *pic, ^ 86. MotionEstContext *me, ScratchpadContext *sc, 87. int chroma_x_shift, int chroma_y_shift, libavcodec/mpegpicture.c:108:13: Call 106. pic->f->height = avctx->height; 107. pic->f->format = avctx->pix_fmt; 108. r = avcodec_default_get_buffer2(avctx, pic->f, 0); ^ 109. } 110. libavcodec/utils.c:512:1: Parameter `frame->nb_samples` 510. } 511. 512. int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags) ^ 513. { 514. int ret; libavcodec/utils.c:519:16: Call 517. return av_hwframe_get_buffer(avctx->hw_frames_ctx, frame, 0); 518. 519. if ((ret = update_frame_pool(avctx, frame)) < 0) ^ 520. return ret; 521. libavcodec/utils.c:334:1: Parameter `frame->nb_samples` 332. } 333. 334. static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) ^ 335. { 336. FramePool *pool = avctx->internal->pool; libavcodec/utils.c:402:15: Call 400. 401. av_buffer_pool_uninit(&pool->pools[0]); 402. ret = av_samples_get_buffer_size(&pool->linesize[0], ch, ^ 403. frame->nb_samples, frame->format, 0); 404. if (ret < 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 `alloc_picture` 122. return AVERROR(EINVAL); 123. align = 1; 124. nb_samples = FFALIGN(nb_samples, 32); ^ 125. } 126.
https://github.com/libav/libav/blob/11b8030309ee93d79b3a6cd4b83bf00757db1598/libavutil/samplefmt.c/#L124
d2a_code_trace_data_42762
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:933: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_sqr`. Showing all 17 steps of the trace test/bntest.c:930:17: Call 928. BN_bntest_rand(a, 512, 0, 0); 929. for (j = 0; j < 2; j++) { 930. t = BN_GF2m_mod_solve_quad(c, a, b[j], ctx); ^ 931. if (t) { 932. s++; crypto/bn/bn_gf2m.c:1087:1: Parameter `ctx->stack.depth` 1085. * for best performance, use the BN_GF2m_mod_solve_quad_arr function. 1086. */ 1087. > int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 1088. BN_CTX *ctx) 1089. { test/bntest.c:930:17: Call 928. BN_bntest_rand(a, 512, 0, 0); 929. for (j = 0; j < 2; j++) { 930. t = BN_GF2m_mod_solve_quad(c, a, b[j], ctx); ^ 931. if (t) { 932. s++; crypto/bn/bn_gf2m.c:1087:1: Parameter `ctx->stack.depth` 1085. * for best performance, use the BN_GF2m_mod_solve_quad_arr function. 1086. */ 1087. > int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 1088. BN_CTX *ctx) 1089. { test/bntest.c:933:17: Call 931. if (t) { 932. s++; 933. BN_GF2m_mod_sqr(d, c, b[j], ctx); ^ 934. BN_GF2m_add(d, c, d); 935. BN_GF2m_mod(e, a, b[j]); crypto/bn/bn_gf2m.c:524:1: Parameter `ctx->stack.depth` 522. * use the BN_GF2m_mod_sqr_arr function. 523. */ 524. > int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 525. { 526. int ret = 0; crypto/bn/bn_gf2m.c:539:11: Call 537. goto err; 538. } 539. ret = BN_GF2m_mod_sqr_arr(r, a, arr, ctx); ^ 540. bn_check_top(r); 541. err: crypto/bn/bn_gf2m.c:496:5: Call 494. 495. bn_check_top(a); 496. BN_CTX_start(ctx); ^ 497. if ((s = BN_CTX_get(ctx)) == NULL) 498. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gf2m.c:514:5: Call 512. ret = 1; 513. err: 514. BN_CTX_end(ctx); ^ 515. return ret; 516. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_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_42763
static int dca_subsubframe(DCAContext * s) { int k, l; int subsubframe = s->current_subsubframe; const float *quant_step_table; float subband_samples[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][8]; if (s->bit_rate == 0x1f) quant_step_table = lossless_quant_d; else quant_step_table = lossy_quant_d; for (k = 0; k < s->prim_channels; k++) { for (l = 0; l < s->vq_start_subband[k]; l++) { int m; int abits = s->bitalloc[k][l]; float quant_step_size = quant_step_table[abits]; float rscale; int sel = s->quant_index_huffman[k][abits]; if(!abits){ memset(subband_samples[k][l], 0, 8 * sizeof(subband_samples[0][0][0])); }else if(abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table){ if(abits <= 7){ int block_code1, block_code2, size, levels; int block[8]; size = abits_sizes[abits-1]; levels = abits_levels[abits-1]; block_code1 = get_bits(&s->gb, size); decode_blockcode(block_code1, levels, block); block_code2 = get_bits(&s->gb, size); decode_blockcode(block_code2, levels, &block[4]); for (m = 0; m < 8; m++) subband_samples[k][l][m] = block[m]; }else{ for (m = 0; m < 8; m++) subband_samples[k][l][m] = get_sbits(&s->gb, abits - 3); } }else{ for (m = 0; m < 8; m++) subband_samples[k][l][m] = get_bitalloc(&s->gb, &dca_smpl_bitalloc[abits], sel); } if (s->transition_mode[k][l] && subsubframe >= s->transition_mode[k][l]) rscale = quant_step_size * s->scale_factor[k][l][1]; else rscale = quant_step_size * s->scale_factor[k][l][0]; rscale *= s->scalefactor_adj[k][sel]; for (m = 0; m < 8; m++) subband_samples[k][l][m] *= rscale; if (s->prediction_mode[k][l]) { int n; for (m = 0; m < 8; m++) { for (n = 1; n <= 4; n++) if (m >= n) subband_samples[k][l][m] += (adpcm_vb[s->prediction_vq[k][l]][n - 1] * subband_samples[k][l][m - n] / 8192); else if (s->predictor_history) subband_samples[k][l][m] += (adpcm_vb[s->prediction_vq[k][l]][n - 1] * s->subband_samples_hist[k][l][m - n + 4] / 8192); } } } for (l = s->vq_start_subband[k]; l < s->subband_activity[k]; l++) { int m; if (!s->debug_flag & 0x01) { av_log(s->avctx, AV_LOG_DEBUG, "Stream with high frequencies VQ coding\n"); s->debug_flag |= 0x01; } for (m = 0; m < 8; m++) { subband_samples[k][l][m] = high_freq_vq[s->high_freq_vq[k][l]][subsubframe * 8 + m] * (float) s->scale_factor[k][l][0] / 16.0; } } } if (s->aspf || subsubframe == s->subsubframes - 1) { if (0xFFFF == get_bits(&s->gb, 16)) { #ifdef TRACE av_log(s->avctx, AV_LOG_DEBUG, "Got subframe DSYNC\n"); #endif } else { av_log(s->avctx, AV_LOG_ERROR, "Didn't get subframe DSYNC\n"); } } for (k = 0; k < s->prim_channels; k++) for (l = 0; l < s->vq_start_subband[k]; l++) memcpy(s->subband_samples_hist[k][l], &subband_samples[k][l][4], 4 * sizeof(subband_samples[0][0][0])); for (k = 0; k < s->prim_channels; k++) { qmf_32_subbands(s, k, subband_samples[k], &s->samples[256 * k], 2.0 / 3 , 0 ); } if (s->prim_channels > dca_channels[s->output & DCA_CHANNEL_MASK]) { dca_downmix(s->samples, s->amode, s->downmix_coef); } if (s->output & DCA_LFE) { int lfe_samples = 2 * s->lfe * s->subsubframes; int i_channels = dca_channels[s->output & DCA_CHANNEL_MASK]; lfe_interpolation_fir(s->lfe, 2 * s->lfe, s->lfe_data + lfe_samples + 2 * s->lfe * subsubframe, &s->samples[256 * i_channels], 256.0, 0 ); } return 0; } libavcodec/dca.c:943: error: Buffer Overrun L2 Offset: [0, 6] Size: 4. libavcodec/dca.c:934:22: <Offset trace> 932. if (s->prediction_mode[k][l]) { 933. int n; 934. for (m = 0; m < 8; m++) { ^ 935. for (n = 1; n <= 4; n++) 936. if (m >= n) libavcodec/dca.c:934:22: Assignment 932. if (s->prediction_mode[k][l]) { 933. int n; 934. for (m = 0; m < 8; m++) { ^ 935. for (n = 1; n <= 4; n++) 936. if (m >= n) libavcodec/dca.c:848:1: <Length trace> 846. static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 }; 847. 848. static int dca_subsubframe(DCAContext * s) ^ 849. { 850. int k, l; libavcodec/dca.c:848:1: Parameter `s->subband_samples_hist[*][*][*]` 846. static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 }; 847. 848. static int dca_subsubframe(DCAContext * s) ^ 849. { 850. int k, l; libavcodec/dca.c:943:34: Array access: Offset: [0, 6] Size: 4 941. subband_samples[k][l][m] += 942. (adpcm_vb[s->prediction_vq[k][l]][n - 1] * 943. s->subband_samples_hist[k][l][m - n + ^ 944. 4] / 8192); 945. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dca.c/#L943
d2a_code_trace_data_42764
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/ecp_smpl.c:850: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_add_quick`. Showing all 18 steps of the trace crypto/ec/ecp_smpl.c:823:10: Call 821. 822. BN_CTX_start(ctx); 823. n0 = BN_CTX_get(ctx); ^ 824. n1 = BN_CTX_get(ctx); 825. n2 = BN_CTX_get(ctx); 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:366:15: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/bn/bn_lib.c:366:5: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/ec/ecp_smpl.c:850:14: Call 848. if (!field_sqr(group, n1, a->Z, ctx)) 849. goto err; 850. if (!BN_mod_add_quick(n0, a->X, n1, p)) ^ 851. goto err; 852. if (!BN_mod_sub_quick(n2, a->X, n1, p)) crypto/bn/bn_mod.c:93:1: Parameter `*r->d` 91. } 92. 93. > int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 94. const BIGNUM *m) 95. { crypto/bn/bn_mod.c:96:15: Call 94. const BIGNUM *m) 95. { 96. int ret = bn_mod_add_fixed_top(r, a, b, m); ^ 97. 98. if (ret) crypto/bn/bn_mod.c:48:1: Parameter `*r->d` 46. * move depending on whether or not subtraction borrowed. 47. */ 48. > int bn_mod_add_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 49. const BIGNUM *m) 50. { crypto/bn/bn_mod.c:56:9: Call 54. const BN_ULONG *ap, *bp; 55. 56. if (bn_wexpand(r, mtop) == NULL) ^ 57. return 0; 58. crypto/bn/bn_lib.c:948:1: Parameter `*a->d` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:950:37: Call 948. BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 951. } 952. 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_mod_add_quick` 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/4cc968df403ed9321d0df722aba33323ae575ce0/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_42765
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) { bn_check_top(b); if (a == b) return a; if (bn_wexpand(a, b->top) == NULL) return NULL; if (b->top > 0) memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); a->top = b->top; a->neg = b->neg; bn_check_top(a); return a; } crypto/sm2/sm2_sign.c:115: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_POINT_mul`. Showing all 19 steps of the trace crypto/sm2/sm2_sign.c:110:14: Call 108. 109. for (;;) { 110. if (!BN_priv_rand_range(k, order)) { ^ 111. SM2err(SM2_F_SM2_SIG_GEN, ERR_R_INTERNAL_ERROR); 112. goto done; crypto/bn/bn_rand.c:184:12: Call 182. int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range) 183. { 184. return bnrand_range(PRIVATE, r, range); ^ 185. } 186. crypto/bn/bn_rand.c:113:1: Parameter `r->top` 111. 112. /* random number r: 0 <= r < range */ 113. > static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range) 114. { 115. int n; crypto/sm2/sm2_sign.c:115:14: Call 113. } 114. 115. if (!EC_POINT_mul(group, kG, k, NULL, NULL, ctx) ^ 116. || !EC_POINT_get_affine_coordinates_GFp(group, kG, x1, NULL, 117. ctx) crypto/ec/ec_lib.c:929:1: Parameter `g_scalar->top` 927. } 928. 929. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, 930. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) 931. { crypto/ec/ec_lib.c:940:12: Call 938. scalars[0] = p_scalar; 939. 940. return EC_POINTs_mul(group, r, g_scalar, ^ 941. (point != NULL 942. && p_scalar != NULL), points, scalars, ctx); crypto/ec/ec_lib.c:918:1: Parameter `scalar->top` 916. */ 917. 918. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 919. size_t num, const EC_POINT *points[], 920. const BIGNUM *scalars[], BN_CTX *ctx) crypto/ec/ec_lib.c:924:16: Call 922. if (group->meth->mul == 0) 923. /* use default */ 924. return ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); ^ 925. 926. return group->meth->mul(group, r, scalar, num, points, scalars, ctx); crypto/ec/ec_mult.c:342:1: Parameter `scalar->top` 340. * in the addition if scalar != NULL 341. */ 342. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 343. size_t num, const EC_POINT *points[], const BIGNUM *scalars[], 344. BN_CTX *ctx) crypto/ec/ec_mult.c:393:16: Call 391. * constant time version. 392. */ 393. return ec_mul_consttime(group, r, scalar, NULL, ctx); ^ 394. } 395. if ((scalar == NULL) && (num == 1)) { crypto/ec/ec_mult.c:131:1: Parameter `scalar->top` 129. * Returns 1 on success, 0 otherwise. 130. */ 131. > static int ec_mul_consttime(const EC_GROUP *group, EC_POINT *r, 132. const BIGNUM *scalar, const EC_POINT *point, 133. BN_CTX *ctx) crypto/ec/ec_mult.c:179:10: Call 177. goto err; 178. 179. if (!BN_copy(k, scalar)) ^ 180. goto err; 181. crypto/bn/bn_lib.c:285:1: <Offset trace> 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:285:1: <Length trace> 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:285:1: Parameter `*a->d` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:291:9: Call 289. if (a == b) 290. return a; 291. if (bn_wexpand(a, b->top) == NULL) ^ 292. return NULL; 293. crypto/bn/bn_lib.c:941:1: Parameter `*a->d` 939. } 940. 941. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 942. { 943. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:295:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_POINT_mul` 293. 294. if (b->top > 0) 295. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 296. 297. a->top = b->top;
https://github.com/openssl/openssl/blob/630fe1da888490b7dfef3fe0928b813ddff5d51a/crypto/bn/bn_lib.c/#L295
d2a_code_trace_data_42766
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; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/t1_lib.c:1440: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `s->s3->previous_server_finished_len` + `pkt->written` + 17]):unsigned64 by call to `WPACKET_put_bytes__`. Showing all 10 steps of the trace ssl/t1_lib.c:1407:10: Call 1405. #endif 1406. 1407. if (!WPACKET_start_sub_packet_u16(pkt) ^ 1408. || !WPACKET_set_flags(pkt, WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH)) { 1409. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); ssl/packet.c:205:1: Parameter `pkt->buf->length` 203. } 204. 205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 206. { 207. WPACKET_SUB *sub; ssl/t1_lib.c:1440:14: Call 1438. tls1_get_formatlist(s, &plist, &plistlen); 1439. 1440. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) ^ 1441. || !WPACKET_start_sub_packet_u16(pkt) 1442. || !WPACKET_sub_memcpy_u8(pkt, plist, plistlen) ssl/packet.c:242:1: Parameter `pkt->written` 240. } 241. 242. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 243. { 244. unsigned char *data; ssl/packet.c:250:17: Call 248. 249. if (size > sizeof(unsigned int) 250. || !WPACKET_allocate_bytes(pkt, size, &data) ^ 251. || !put_value(data, val, size)) 252. return 0; 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 + s->s3->previous_server_finished_len + pkt->written + 17]):unsigned64 by call to `WPACKET_put_bytes__` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27. size_t reflen;
https://github.com/openssl/openssl/blob/7507e73d409b8f3046d6efcc3f4c0b6208b59b64/ssl/packet.c/#L25
d2a_code_trace_data_42767
int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy) { int rv, start_idx, i; if (x == NULL) { x = sk_X509_value(sk, 0); start_idx = 1; } else start_idx = 0; rv = ssl_security_cert(s, NULL, x, vfy, 1); if (rv != 1) return rv; for (i = start_idx; i < sk_X509_num(sk); i++) { x = sk_X509_value(sk, i); rv = ssl_security_cert(s, NULL, x, vfy, 0); if (rv != 1) return rv; } return 1; } ssl/t1_lib.c:4317: error: NULL_DEREFERENCE pointer `null` is dereferenced by call to `ssl_security_cert()` at line 4317, column 10. Showing all 4 steps of the trace ssl/t1_lib.c:4308:1: start of procedure ssl_security_cert_chain() 4306. */ 4307. 4308. > int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy) 4309. { 4310. int rv, start_idx, i; ssl/t1_lib.c:4311:9: Taking false branch 4309. { 4310. int rv, start_idx, i; 4311. if (x == NULL) { ^ 4312. x = sk_X509_value(sk, 0); 4313. start_idx = 1; ssl/t1_lib.c:4315:9: 4313. start_idx = 1; 4314. } else 4315. > start_idx = 0; 4316. 4317. rv = ssl_security_cert(s, NULL, x, vfy, 1); ssl/t1_lib.c:4317:5: 4315. start_idx = 0; 4316. 4317. > rv = ssl_security_cert(s, NULL, x, vfy, 1); 4318. if (rv != 1) 4319. return rv;
https://github.com/openssl/openssl/blob/57ce7b617c602ae8513c22daa2bda31f179edb0f/ssl/t1_lib.c/#L4317
d2a_code_trace_data_42768
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } ssl/t1_lib.c:1860: error: INTEGER_OVERFLOW_L2 ([2, +oo] - 18):unsigned64 by call to `PACKET_get_bytes`. Showing all 9 steps of the trace ssl/t1_lib.c:1858:9: Assignment 1856. return; 1857. } else { 1858. const size_t len = sizeof(kSafariExtensionsBlock); ^ 1859. 1860. if (!PACKET_get_bytes(&tmppkt, &eblock1, len) ssl/t1_lib.c:1860:14: Call 1858. const size_t len = sizeof(kSafariExtensionsBlock); 1859. 1860. if (!PACKET_get_bytes(&tmppkt, &eblock1, len) ^ 1861. || PACKET_remaining(&tmppkt)) 1862. return; ssl/packet_locl.h:344:8: Parameter `len` 342. * freed 343. */ 344. __owur static ossl_inline int PACKET_get_bytes(PACKET *pkt, ^ 345. const unsigned char **data, 346. size_t len) ssl/packet_locl.h:351:5: Call 349. return 0; 350. 351. packet_forward(pkt, len); ^ 352. 353. return 1; ssl/packet_locl.h:81:1: <LHS trace> 79. 80. /* Internal unchecked shorthand; don't use outside this file. */ 81. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 82. { 83. pkt->curr += len; ssl/packet_locl.h:81:1: Parameter `pkt->remaining` 79. 80. /* Internal unchecked shorthand; don't use outside this file. */ 81. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 82. { 83. pkt->curr += len; ssl/packet_locl.h:81:1: <RHS trace> 79. 80. /* Internal unchecked shorthand; don't use outside this file. */ 81. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 82. { 83. pkt->curr += len; ssl/packet_locl.h:81:1: Parameter `len` 79. 80. /* Internal unchecked shorthand; don't use outside this file. */ 81. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 82. { 83. pkt->curr += len; ssl/packet_locl.h:84:5: Binary operation: ([2, +oo] - 18):unsigned64 by call to `PACKET_get_bytes` 82. { 83. pkt->curr += len; 84. pkt->remaining -= len; ^ 85. } 86.
https://github.com/openssl/openssl/blob/d6c2587967f93f2f9c226bda9139ae427698f20f/ssl/packet_locl.h/#L84
d2a_code_trace_data_42769
static int check_chain_extensions(X509_STORE_CTX *ctx) { #ifdef OPENSSL_NO_CHAIN_VERIFY return 1; #else int i, ok=0, must_be_ca, plen = 0; X509 *x; int (*cb)(int xok,X509_STORE_CTX *xctx); int proxy_path_length = 0; int purpose; int allow_proxy_certs; cb=ctx->verify_cb; must_be_ca = -1; if (ctx->parent) { allow_proxy_certs = 0; purpose = X509_PURPOSE_CRL_SIGN; } else { allow_proxy_certs = !!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); if (getenv("OPENSSL_ALLOW_PROXY_CERTS")) allow_proxy_certs = 1; purpose = ctx->param->purpose; } for (i = 0; i < ctx->last_untrusted; i++) { int ret; x = sk_X509_value(ctx->chain, i); if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) && (x->ex_flags & EXFLAG_CRITICAL)) { ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION; ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY)) { ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED; ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } ret = X509_check_ca(x); switch(must_be_ca) { case -1: if ((ctx->param->flags & X509_V_FLAG_X509_STRICT) && (ret != 1) && (ret != 0)) { ret = 0; ctx->error = X509_V_ERR_INVALID_CA; } else ret = 1; break; case 0: if (ret != 0) { ret = 0; ctx->error = X509_V_ERR_INVALID_NON_CA; } else ret = 1; break; default: if ((ret == 0) || ((ctx->param->flags & X509_V_FLAG_X509_STRICT) && (ret != 1))) { ret = 0; ctx->error = X509_V_ERR_INVALID_CA; } else ret = 1; break; } if (ret == 0) { ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } if (ctx->param->purpose > 0) { ret = X509_check_purpose(x, purpose, must_be_ca > 0); if ((ret == 0) || ((ctx->param->flags & X509_V_FLAG_X509_STRICT) && (ret != 1))) { ctx->error = X509_V_ERR_INVALID_PURPOSE; ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } } if ((i > 1) && !(x->ex_flags & EXFLAG_SI) && (x->ex_pathlen != -1) && (plen > (x->ex_pathlen + proxy_path_length + 1))) { ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED; ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } if (!(x->ex_flags & EXFLAG_SI)) plen++; if (x->ex_flags & EXFLAG_PROXY) { if (x->ex_pcpathlen != -1 && i > x->ex_pcpathlen) { ctx->error = X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED; ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } proxy_path_length++; must_be_ca = 0; } else must_be_ca = 1; } ok = 1; end: return ok; #endif } crypto/x509/x509_vfy.c:591: error: NULL_DEREFERENCE pointer `x` last assigned on line 589 could be null and is dereferenced at line 591, column 8. Showing all 23 steps of the trace crypto/x509/x509_vfy.c:545:1: start of procedure check_chain_extensions() 543. */ 544. 545. > static int check_chain_extensions(X509_STORE_CTX *ctx) 546. { 547. #ifdef OPENSSL_NO_CHAIN_VERIFY crypto/x509/x509_vfy.c:550:2: 548. return 1; 549. #else 550. > int i, ok=0, must_be_ca, plen = 0; 551. X509 *x; 552. int (*cb)(int xok,X509_STORE_CTX *xctx); crypto/x509/x509_vfy.c:553:2: 551. X509 *x; 552. int (*cb)(int xok,X509_STORE_CTX *xctx); 553. > int proxy_path_length = 0; 554. int purpose; 555. int allow_proxy_certs; crypto/x509/x509_vfy.c:556:2: 554. int purpose; 555. int allow_proxy_certs; 556. > cb=ctx->verify_cb; 557. 558. /* must_be_ca can have 1 of 3 values: crypto/x509/x509_vfy.c:566:2: 564. all certificates in the chain except the leaf certificate. 565. */ 566. > must_be_ca = -1; 567. 568. /* CRL path validation */ crypto/x509/x509_vfy.c:569:6: Taking false branch 567. 568. /* CRL path validation */ 569. if (ctx->parent) ^ 570. { 571. allow_proxy_certs = 0; crypto/x509/x509_vfy.c:577:7: Condition is true 575. { 576. allow_proxy_certs = 577. !!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); ^ 578. /* A hack to keep people who don't want to modify their 579. software happy */ crypto/x509/x509_vfy.c:577:4: 575. { 576. allow_proxy_certs = 577. > !!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); 578. /* A hack to keep people who don't want to modify their 579. software happy */ crypto/x509/x509_vfy.c:576:3: 574. else 575. { 576. > allow_proxy_certs = 577. !!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); 578. /* A hack to keep people who don't want to modify their crypto/x509/x509_vfy.c:580:7: Taking false branch 578. /* A hack to keep people who don't want to modify their 579. software happy */ 580. if (getenv("OPENSSL_ALLOW_PROXY_CERTS")) ^ 581. allow_proxy_certs = 1; 582. purpose = ctx->param->purpose; crypto/x509/x509_vfy.c:582:3: 580. if (getenv("OPENSSL_ALLOW_PROXY_CERTS")) 581. allow_proxy_certs = 1; 582. > purpose = ctx->param->purpose; 583. } 584. crypto/x509/x509_vfy.c:586:7: 584. 585. /* Check all untrusted certificates */ 586. > for (i = 0; i < ctx->last_untrusted; i++) 587. { 588. int ret; crypto/x509/x509_vfy.c:586:14: Loop condition is true. Entering loop body 584. 585. /* Check all untrusted certificates */ 586. for (i = 0; i < ctx->last_untrusted; i++) ^ 587. { 588. int ret; crypto/x509/x509_vfy.c:589:7: Condition is true 587. { 588. int ret; 589. x = sk_X509_value(ctx->chain, i); ^ 590. if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) 591. && (x->ex_flags & EXFLAG_CRITICAL)) crypto/x509/x509_vfy.c:589:3: 587. { 588. int ret; 589. > x = sk_X509_value(ctx->chain, i); 590. if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) 591. && (x->ex_flags & EXFLAG_CRITICAL)) crypto/stack/stack.c:337:1: start of procedure sk_value() 335. } 336. 337. > void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; crypto/stack/stack.c:339:6: Taking false branch 337. void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 340. return st->data[i]; 341. } crypto/stack/stack.c:339:13: Taking false branch 337. void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 340. return st->data[i]; 341. } crypto/stack/stack.c:339:24: Taking true branch 337. void *sk_value(const _STACK *st, int i) 338. { 339. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 340. return st->data[i]; 341. } crypto/stack/stack.c:339:39: 337. void *sk_value(const _STACK *st, int i) 338. { 339. > if(!st || (i < 0) || (i >= st->num)) return NULL; 340. return st->data[i]; 341. } crypto/stack/stack.c:341:1: return from a call to sk_value 339. if(!st || (i < 0) || (i >= st->num)) return NULL; 340. return st->data[i]; 341. > } 342. 343. void *sk_set(_STACK *st, int i, void *value) crypto/x509/x509_vfy.c:590:9: Taking true branch 588. int ret; 589. x = sk_X509_value(ctx->chain, i); 590. if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) ^ 591. && (x->ex_flags & EXFLAG_CRITICAL)) 592. { crypto/x509/x509_vfy.c:591:8: 589. x = sk_X509_value(ctx->chain, i); 590. if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) 591. > && (x->ex_flags & EXFLAG_CRITICAL)) 592. { 593. ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION;
https://github.com/openssl/openssl/blob/750487899ad2b794078ed998b513a4a14f60f2cc/crypto/x509/x509_vfy.c/#L591
d2a_code_trace_data_42770
int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, const uint8_t *buf, int len) { unsigned int ssrc, h; int payload_type, seq, ret, flags = 0; AVStream *st; uint32_t timestamp; int rv= 0; if (!buf) { if(s->st && s->parse_packet) { timestamp = RTP_NOTS_VALUE; rv= s->parse_packet(s->ic, s->dynamic_protocol_context, s->st, pkt, &timestamp, NULL, 0, flags); finalize_packet(s, pkt, timestamp); return rv; } else { if (s->read_buf_index >= s->read_buf_size) return -1; ret = ff_mpegts_parse_packet(s->ts, pkt, s->buf + s->read_buf_index, s->read_buf_size - s->read_buf_index); if (ret < 0) return -1; s->read_buf_index += ret; if (s->read_buf_index < s->read_buf_size) return 1; else return 0; } } if (len < 12) return -1; if ((buf[0] & 0xc0) != (RTP_VERSION << 6)) return -1; if (buf[1] >= RTCP_SR && buf[1] <= RTCP_APP) { return rtcp_parse_packet(s, buf, len); } payload_type = buf[1] & 0x7f; if (buf[1] & 0x80) flags |= RTP_FLAG_MARKER; seq = AV_RB16(buf + 2); timestamp = AV_RB32(buf + 4); ssrc = AV_RB32(buf + 8); s->ssrc = ssrc; if (s->payload_type != payload_type) return -1; st = s->st; if(!rtp_valid_packet_in_sequence(&s->statistics, seq)) { av_log(st?st->codec:NULL, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n", payload_type, seq, ((s->seq + 1) & 0xffff)); return -1; } s->seq = seq; len -= 12; buf += 12; if (!st) { ret = ff_mpegts_parse_packet(s->ts, pkt, buf, len); if (ret < 0) return -1; if (ret < len) { s->read_buf_size = len - ret; memcpy(s->buf, buf + ret, s->read_buf_size); s->read_buf_index = 0; return 1; } return 0; } else if (s->parse_packet) { rv = s->parse_packet(s->ic, s->dynamic_protocol_context, s->st, pkt, &timestamp, buf, len, flags); } else { switch(st->codec->codec_id) { case CODEC_ID_MP2: case CODEC_ID_MP3: if (len <= 4) return -1; h = AV_RB32(buf); len -= 4; buf += 4; av_new_packet(pkt, len); memcpy(pkt->data, buf, len); break; case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: if (len <= 4) return -1; h = AV_RB32(buf); buf += 4; len -= 4; if (h & (1 << 26)) { if (len <= 4) return -1; buf += 4; len -= 4; } av_new_packet(pkt, len); memcpy(pkt->data, buf, len); break; default: av_new_packet(pkt, len); memcpy(pkt->data, buf, len); break; } pkt->stream_index = st->index; } finalize_packet(s, pkt, timestamp); return rv; } libavformat/rtpdec.c:518: error: Null Dereference pointer `pkt->data` last assigned on line 517 could be null and is dereferenced by call to `memcpy()` at line 518, column 13. libavformat/rtpdec.c:422:1: start of procedure rtp_parse_packet() 420. * (use buf as NULL to read the next). -1 if no packet (error or no more packet). 421. */ 422. int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, ^ 423. const uint8_t *buf, int len) 424. { libavformat/rtpdec.c:426:5: 424. { 425. unsigned int ssrc, h; 426. int payload_type, seq, ret, flags = 0; ^ 427. AVStream *st; 428. uint32_t timestamp; libavformat/rtpdec.c:429:5: 427. AVStream *st; 428. uint32_t timestamp; 429. int rv= 0; ^ 430. 431. if (!buf) { libavformat/rtpdec.c:431:10: Taking false branch 429. int rv= 0; 430. 431. if (!buf) { ^ 432. /* return the next packets, if any */ 433. if(s->st && s->parse_packet) { libavformat/rtpdec.c:457:9: Taking false branch 455. } 456. 457. if (len < 12) ^ 458. return -1; 459. libavformat/rtpdec.c:460:9: Taking false branch 458. return -1; 459. 460. if ((buf[0] & 0xc0) != (RTP_VERSION << 6)) ^ 461. return -1; 462. if (buf[1] >= RTCP_SR && buf[1] <= RTCP_APP) { libavformat/rtpdec.c:462:9: Taking false branch 460. if ((buf[0] & 0xc0) != (RTP_VERSION << 6)) 461. return -1; 462. if (buf[1] >= RTCP_SR && buf[1] <= RTCP_APP) { ^ 463. return rtcp_parse_packet(s, buf, len); 464. } libavformat/rtpdec.c:465:5: 463. return rtcp_parse_packet(s, buf, len); 464. } 465. payload_type = buf[1] & 0x7f; ^ 466. if (buf[1] & 0x80) 467. flags |= RTP_FLAG_MARKER; libavformat/rtpdec.c:466:9: Taking true branch 464. } 465. payload_type = buf[1] & 0x7f; 466. if (buf[1] & 0x80) ^ 467. flags |= RTP_FLAG_MARKER; 468. seq = AV_RB16(buf + 2); libavformat/rtpdec.c:467:9: 465. payload_type = buf[1] & 0x7f; 466. if (buf[1] & 0x80) 467. flags |= RTP_FLAG_MARKER; ^ 468. seq = AV_RB16(buf + 2); 469. timestamp = AV_RB32(buf + 4); libavformat/rtpdec.c:468:5: 466. if (buf[1] & 0x80) 467. flags |= RTP_FLAG_MARKER; 468. seq = AV_RB16(buf + 2); ^ 469. timestamp = AV_RB32(buf + 4); 470. ssrc = AV_RB32(buf + 8); libavutil/bswap.h:58:1: start of procedure av_bswap16() 56. 57. #ifndef av_bswap16 58. static av_always_inline av_const uint16_t av_bswap16(uint16_t x) ^ 59. { 60. x= (x>>8) | (x<<8); libavutil/bswap.h:60:5: 58. static av_always_inline av_const uint16_t av_bswap16(uint16_t x) 59. { 60. x= (x>>8) | (x<<8); ^ 61. return x; 62. } libavutil/bswap.h:61:5: 59. { 60. x= (x>>8) | (x<<8); 61. return x; ^ 62. } 63. #endif libavutil/bswap.h:62:1: return from a call to av_bswap16 60. x= (x>>8) | (x<<8); 61. return x; 62. } ^ 63. #endif 64. libavformat/rtpdec.c:469:5: 467. flags |= RTP_FLAG_MARKER; 468. seq = AV_RB16(buf + 2); 469. timestamp = AV_RB32(buf + 4); ^ 470. ssrc = AV_RB32(buf + 8); 471. /* store the ssrc in the RTPDemuxContext */ libavutil/bswap.h:66:1: start of procedure av_bswap32() 64. 65. #ifndef av_bswap32 66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x) ^ 67. { 68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); libavutil/bswap.h:68:5: 66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x) 67. { 68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); ^ 69. x= (x>>16) | (x<<16); 70. return x; libavutil/bswap.h:69:5: 67. { 68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); 69. x= (x>>16) | (x<<16); ^ 70. return x; 71. } libavutil/bswap.h:70:5: 68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); 69. x= (x>>16) | (x<<16); 70. return x; ^ 71. } 72. #endif libavutil/bswap.h:71:1: return from a call to av_bswap32 69. x= (x>>16) | (x<<16); 70. return x; 71. } ^ 72. #endif 73. libavformat/rtpdec.c:470:5: 468. seq = AV_RB16(buf + 2); 469. timestamp = AV_RB32(buf + 4); 470. ssrc = AV_RB32(buf + 8); ^ 471. /* store the ssrc in the RTPDemuxContext */ 472. s->ssrc = ssrc; libavutil/bswap.h:66:1: start of procedure av_bswap32() 64. 65. #ifndef av_bswap32 66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x) ^ 67. { 68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); libavutil/bswap.h:68:5: 66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x) 67. { 68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); ^ 69. x= (x>>16) | (x<<16); 70. return x; libavutil/bswap.h:69:5: 67. { 68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); 69. x= (x>>16) | (x<<16); ^ 70. return x; 71. } libavutil/bswap.h:70:5: 68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); 69. x= (x>>16) | (x<<16); 70. return x; ^ 71. } 72. #endif libavutil/bswap.h:71:1: return from a call to av_bswap32 69. x= (x>>16) | (x<<16); 70. return x; 71. } ^ 72. #endif 73. libavformat/rtpdec.c:472:5: 470. ssrc = AV_RB32(buf + 8); 471. /* store the ssrc in the RTPDemuxContext */ 472. s->ssrc = ssrc; ^ 473. 474. /* NOTE: we can handle only one payload type */ libavformat/rtpdec.c:475:9: Taking false branch 473. 474. /* NOTE: we can handle only one payload type */ 475. if (s->payload_type != payload_type) ^ 476. return -1; 477. libavformat/rtpdec.c:478:5: 476. return -1; 477. 478. st = s->st; ^ 479. // only do something with this if all the rtp checks pass... 480. if(!rtp_valid_packet_in_sequence(&s->statistics, seq)) libavformat/rtpdec.c:480:9: 478. st = s->st; 479. // only do something with this if all the rtp checks pass... 480. if(!rtp_valid_packet_in_sequence(&s->statistics, seq)) ^ 481. { 482. av_log(st?st->codec:NULL, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n", libavformat/rtpdec.c:135:1: start of procedure rtp_valid_packet_in_sequence() 133. * returns 1 if we should handle this packet. 134. */ 135. static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq) ^ 136. { 137. uint16_t udelta= seq - s->max_seq; libavformat/rtpdec.c:137:5: 135. static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq) 136. { 137. uint16_t udelta= seq - s->max_seq; ^ 138. const int MAX_DROPOUT= 3000; 139. const int MAX_MISORDER = 100; libavformat/rtpdec.c:138:5: 136. { 137. uint16_t udelta= seq - s->max_seq; 138. const int MAX_DROPOUT= 3000; ^ 139. const int MAX_MISORDER = 100; 140. const int MIN_SEQUENTIAL = 2; libavformat/rtpdec.c:139:5: 137. uint16_t udelta= seq - s->max_seq; 138. const int MAX_DROPOUT= 3000; 139. const int MAX_MISORDER = 100; ^ 140. const int MIN_SEQUENTIAL = 2; 141. libavformat/rtpdec.c:140:5: 138. const int MAX_DROPOUT= 3000; 139. const int MAX_MISORDER = 100; 140. const int MIN_SEQUENTIAL = 2; ^ 141. 142. /* source not valid until MIN_SEQUENTIAL packets with sequence seq. numbers have been received */ libavformat/rtpdec.c:143:8: Taking false branch 141. 142. /* source not valid until MIN_SEQUENTIAL packets with sequence seq. numbers have been received */ 143. if(s->probation) ^ 144. { 145. if(seq==s->max_seq + 1) { libavformat/rtpdec.c:157:16: Taking false branch 155. s->max_seq = seq; 156. } 157. } else if (udelta < MAX_DROPOUT) { ^ 158. // in order, with permissible gap 159. if(seq < s->max_seq) { libavformat/rtpdec.c:164:16: Taking false branch 162. } 163. s->max_seq= seq; 164. } else if (udelta <= RTP_SEQ_MOD - MAX_MISORDER) { ^ 165. // sequence made a large jump... 166. if(seq==s->bad_seq) { libavformat/rtpdec.c:176:5: 174. // duplicate or reordered packet... 175. } 176. s->received++; ^ 177. return 1; 178. } libavformat/rtpdec.c:177:5: 175. } 176. s->received++; 177. return 1; ^ 178. } 179. libavformat/rtpdec.c:178:1: return from a call to rtp_valid_packet_in_sequence 176. s->received++; 177. return 1; 178. } ^ 179. 180. #if 0 libavformat/rtpdec.c:480:9: Taking false branch 478. st = s->st; 479. // only do something with this if all the rtp checks pass... 480. if(!rtp_valid_packet_in_sequence(&s->statistics, seq)) ^ 481. { 482. av_log(st?st->codec:NULL, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n", libavformat/rtpdec.c:487:5: 485. } 486. 487. s->seq = seq; ^ 488. len -= 12; 489. buf += 12; libavformat/rtpdec.c:488:5: 486. 487. s->seq = seq; 488. len -= 12; ^ 489. buf += 12; 490. libavformat/rtpdec.c:489:5: 487. s->seq = seq; 488. len -= 12; 489. buf += 12; ^ 490. 491. if (!st) { libavformat/rtpdec.c:491:10: Taking false branch 489. buf += 12; 490. 491. if (!st) { ^ 492. /* specific MPEG2TS demux support */ 493. ret = ff_mpegts_parse_packet(s->ts, pkt, buf, len); libavformat/rtpdec.c:503:16: Taking false branch 501. } 502. return 0; 503. } else if (s->parse_packet) { ^ 504. rv = s->parse_packet(s->ic, s->dynamic_protocol_context, 505. s->st, pkt, &timestamp, buf, len, flags); libavformat/rtpdec.c:508:9: 506. } else { 507. // at this point, the RTP header has been stripped; This is ASSUMING that there is only 1 CSRC, which in't wise. 508. switch(st->codec->codec_id) { ^ 509. case CODEC_ID_MP2: 510. case CODEC_ID_MP3: libavformat/rtpdec.c:509:9: Switch condition is true. Entering switch case 507. // at this point, the RTP header has been stripped; This is ASSUMING that there is only 1 CSRC, which in't wise. 508. switch(st->codec->codec_id) { 509. case CODEC_ID_MP2: ^ 510. case CODEC_ID_MP3: 511. /* better than nothing: skip mpeg audio RTP header */ libavformat/rtpdec.c:512:17: Taking false branch 510. case CODEC_ID_MP3: 511. /* better than nothing: skip mpeg audio RTP header */ 512. if (len <= 4) ^ 513. return -1; 514. h = AV_RB32(buf); libavformat/rtpdec.c:514:13: 512. if (len <= 4) 513. return -1; 514. h = AV_RB32(buf); ^ 515. len -= 4; 516. buf += 4; libavutil/bswap.h:66:1: start of procedure av_bswap32() 64. 65. #ifndef av_bswap32 66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x) ^ 67. { 68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); libavutil/bswap.h:68:5: 66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x) 67. { 68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); ^ 69. x= (x>>16) | (x<<16); 70. return x; libavutil/bswap.h:69:5: 67. { 68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); 69. x= (x>>16) | (x<<16); ^ 70. return x; 71. } libavutil/bswap.h:70:5: 68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); 69. x= (x>>16) | (x<<16); 70. return x; ^ 71. } 72. #endif libavutil/bswap.h:71:1: return from a call to av_bswap32 69. x= (x>>16) | (x<<16); 70. return x; 71. } ^ 72. #endif 73. libavformat/rtpdec.c:515:13: 513. return -1; 514. h = AV_RB32(buf); 515. len -= 4; ^ 516. buf += 4; 517. av_new_packet(pkt, len); libavformat/rtpdec.c:516:13: 514. h = AV_RB32(buf); 515. len -= 4; 516. buf += 4; ^ 517. av_new_packet(pkt, len); 518. memcpy(pkt->data, buf, len); libavformat/rtpdec.c:517:13: 515. len -= 4; 516. buf += 4; 517. av_new_packet(pkt, len); ^ 518. memcpy(pkt->data, buf, len); 519. break; libavcodec/avpacket.c:48:1: start of procedure av_new_packet() 46. } 47. 48. int av_new_packet(AVPacket *pkt, int size) ^ 49. { 50. uint8_t *data= NULL; libavcodec/avpacket.c:50:5: 48. int av_new_packet(AVPacket *pkt, int size) 49. { 50. uint8_t *data= NULL; ^ 51. if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) 52. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); libavcodec/avpacket.c:51:8: Taking true branch 49. { 50. uint8_t *data= NULL; 51. if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) ^ 52. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); 53. if (data){ libavcodec/avpacket.c:52:9: 50. uint8_t *data= NULL; 51. if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) 52. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); ^ 53. if (data){ 54. memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(unsigned int size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(unsigned int size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking true branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) ^ 73. return NULL; 74. libavutil/mem.c:73:9: 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) 73. return NULL; ^ 74. 75. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:117:1: return from a call to av_malloc 115. #endif 116. return ptr; 117. } ^ 118. 119. void *av_realloc(void *ptr, unsigned int size) libavcodec/avpacket.c:53:9: Taking false branch 51. if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) 52. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); 53. if (data){ ^ 54. memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); 55. }else libavcodec/avpacket.c:56:9: 54. memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); 55. }else 56. size=0; ^ 57. 58. av_init_packet(pkt); libavcodec/avpacket.c:58:5: 56. size=0; 57. 58. av_init_packet(pkt); ^ 59. pkt->data = data; 60. pkt->size = size; libavcodec/avpacket.c:36:1: start of procedure av_init_packet() 34. } 35. 36. void av_init_packet(AVPacket *pkt) ^ 37. { 38. pkt->pts = AV_NOPTS_VALUE; libavcodec/avpacket.c:38:5: 36. void av_init_packet(AVPacket *pkt) 37. { 38. pkt->pts = AV_NOPTS_VALUE; ^ 39. pkt->dts = AV_NOPTS_VALUE; 40. pkt->pos = -1; libavcodec/avpacket.c:39:5: 37. { 38. pkt->pts = AV_NOPTS_VALUE; 39. pkt->dts = AV_NOPTS_VALUE; ^ 40. pkt->pos = -1; 41. pkt->duration = 0; libavcodec/avpacket.c:40:5: 38. pkt->pts = AV_NOPTS_VALUE; 39. pkt->dts = AV_NOPTS_VALUE; 40. pkt->pos = -1; ^ 41. pkt->duration = 0; 42. pkt->convergence_duration = 0; libavcodec/avpacket.c:41:5: 39. pkt->dts = AV_NOPTS_VALUE; 40. pkt->pos = -1; 41. pkt->duration = 0; ^ 42. pkt->convergence_duration = 0; 43. pkt->flags = 0; libavcodec/avpacket.c:42:5: 40. pkt->pos = -1; 41. pkt->duration = 0; 42. pkt->convergence_duration = 0; ^ 43. pkt->flags = 0; 44. pkt->stream_index = 0; libavcodec/avpacket.c:43:5: 41. pkt->duration = 0; 42. pkt->convergence_duration = 0; 43. pkt->flags = 0; ^ 44. pkt->stream_index = 0; 45. pkt->destruct= NULL; libavcodec/avpacket.c:44:5: 42. pkt->convergence_duration = 0; 43. pkt->flags = 0; 44. pkt->stream_index = 0; ^ 45. pkt->destruct= NULL; 46. } libavcodec/avpacket.c:45:5: 43. pkt->flags = 0; 44. pkt->stream_index = 0; 45. pkt->destruct= NULL; ^ 46. } 47. libavcodec/avpacket.c:46:1: return from a call to av_init_packet 44. pkt->stream_index = 0; 45. pkt->destruct= NULL; 46. } ^ 47. 48. int av_new_packet(AVPacket *pkt, int size) libavcodec/avpacket.c:59:5: 57. 58. av_init_packet(pkt); 59. pkt->data = data; ^ 60. pkt->size = size; 61. pkt->destruct = av_destruct_packet; libavcodec/avpacket.c:60:5: 58. av_init_packet(pkt); 59. pkt->data = data; 60. pkt->size = size; ^ 61. pkt->destruct = av_destruct_packet; 62. if(!data) libavcodec/avpacket.c:61:5: 59. pkt->data = data; 60. pkt->size = size; 61. pkt->destruct = av_destruct_packet; ^ 62. if(!data) 63. return AVERROR(ENOMEM); libavcodec/avpacket.c:62:9: Taking true branch 60. pkt->size = size; 61. pkt->destruct = av_destruct_packet; 62. if(!data) ^ 63. return AVERROR(ENOMEM); 64. return 0; libavcodec/avpacket.c:63:9: 61. pkt->destruct = av_destruct_packet; 62. if(!data) 63. return AVERROR(ENOMEM); ^ 64. return 0; 65. } libavcodec/avpacket.c:65:1: return from a call to av_new_packet 63. return AVERROR(ENOMEM); 64. return 0; 65. } ^ 66. 67. void av_shrink_packet(AVPacket *pkt, int size) libavformat/rtpdec.c:518:13: 516. buf += 4; 517. av_new_packet(pkt, len); 518. memcpy(pkt->data, buf, len); ^ 519. break; 520. case CODEC_ID_MPEG1VIDEO:
https://github.com/libav/libav/blob/f41237c9dbe9751ef025812edebdec762797e57d/libavformat/rtpdec.c/#L518
d2a_code_trace_data_42771
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: [337+min(0, `c->synth_buf_offset[*]`), 352+max(511, `c->synth_buf_offset[*]`)] (⇐ [17+min(0, `c->synth_buf_offset[*]`), 32+max(511, `c->synth_buf_offset[*]`)] + 320) 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:908:9: Assignment 906. for(j=1;j<16;j++) { 907. sum2 = 0; 908. p = synth_buf + 16 + j; ^ 909. SUM8P2(sum, +=, sum2, -=, w, w2, p); 910. p = synth_buf + 48 - j; libavcodec/mpegaudiodec.c:909:9: Array access: Offset: [337+min(0, c->synth_buf_offset[*]), 352+max(511, c->synth_buf_offset[*])] (⇐ [17+min(0, c->synth_buf_offset[*]), 32+max(511, c->synth_buf_offset[*])] + 320) Size: 2 by call to `ff_mpa_synth_filter` 907. sum2 = 0; 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);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L909
d2a_code_trace_data_42772
int BN_set_word(BIGNUM *a, BN_ULONG w) { bn_check_top(a); if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) return 0; a->neg = 0; a->d[0] = w; a->top = (w ? 1 : 0); a->flags &= ~BN_FLG_FIXED_TOP; bn_check_top(a); return 1; } crypto/rsa/rsa_ossl.c:839: error: BUFFER_OVERRUN_L3 Offset: 0 Size: [0, 8388607] by call to `BN_add`. Showing all 14 steps of the trace crypto/rsa/rsa_ossl.c:800:10: Call 798. } 799. 800. if (!BN_sub(r0, r0, m1)) ^ 801. goto err; 802. /* crypto/bn/bn_add.c:45:1: Parameter `*r->d` 43. 44. /* signed sub of b from a. */ 45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 46. { 47. int ret, r_neg, cmp_res; crypto/bn/bn_add.c:59:19: Call 57. if (cmp_res > 0) { 58. r_neg = a->neg; 59. ret = BN_usub(r, a, b); ^ 60. } else if (cmp_res < 0) { 61. r_neg = !b->neg; crypto/bn/bn_add.c:125:1: Parameter `*r->d` 123. 124. /* unsigned subtraction of b from a, a must be larger than b. */ 125. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 126. { 127. int max, min, dif; crypto/rsa/rsa_ossl.c:819:14: Call 817. BN_with_flags(pr1, r1, BN_FLG_CONSTTIME); 818. 819. if (!BN_mod(r0, pr1, rsa->p, ctx)) { ^ 820. BN_free(pr1); 821. goto err; 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/rsa/rsa_ossl.c:839:10: Call 837. if (!BN_mul(r1, r0, rsa->q, ctx)) 838. goto err; 839. if (!BN_add(r0, r1, m1)) ^ 840. goto err; 841. crypto/bn/bn_add.c:14:1: Parameter `*r->d` 12. 13. /* signed add of b to a. */ 14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 15. { 16. int ret, r_neg, cmp_res; crypto/bn/bn_add.c:34:13: Call 32. } else { 33. r_neg = 0; 34. BN_zero(r); ^ 35. ret = 1; 36. } crypto/bn/bn_lib.c:359:1: <Length trace> 357. } 358. 359. > int BN_set_word(BIGNUM *a, BN_ULONG w) 360. { 361. bn_check_top(a); crypto/bn/bn_lib.c:359:1: Parameter `*a->d` 357. } 358. 359. > int BN_set_word(BIGNUM *a, BN_ULONG w) 360. { 361. bn_check_top(a); crypto/bn/bn_lib.c:362:9: Call 360. { 361. bn_check_top(a); 362. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 363. return 0; 364. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `*a->d` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lib.c:365:5: Array access: Offset: 0 Size: [0, 8388607] by call to `BN_add` 363. return 0; 364. a->neg = 0; 365. a->d[0] = w; ^ 366. a->top = (w ? 1 : 0); 367. a->flags &= ~BN_FLG_FIXED_TOP;
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_lib.c/#L365
d2a_code_trace_data_42773
static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int coded, int codingset, int mquant) { GetBitContext *gb = &v->s.gb; MpegEncContext *s = &v->s; int dc_pred_dir = 0; int i; int16_t *dc_val; int16_t *ac_val, *ac_val2; int dcdiff; int a_avail = v->a_avail, c_avail = v->c_avail; int use_pred = s->ac_pred; int scale; int q1, q2 = 0; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; if (n < 4) { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } else { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } if (dcdiff < 0) { av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n"); return -1; } if (dcdiff) { if (dcdiff == 119 ) { if (mquant == 1) dcdiff = get_bits(gb, 10); else if (mquant == 2) dcdiff = get_bits(gb, 9); else dcdiff = get_bits(gb, 8); } else { if (mquant == 1) dcdiff = (dcdiff << 2) + get_bits(gb, 2) - 3; else if (mquant == 2) dcdiff = (dcdiff << 1) + get_bits1(gb) - 1; } if (get_bits1(gb)) dcdiff = -dcdiff; } dcdiff += vc1_pred_dc(&v->s, v->overlap, mquant, n, v->a_avail, v->c_avail, &dc_val, &dc_pred_dir); *dc_val = dcdiff; if (n < 4) { block[0] = dcdiff * s->y_dc_scale; } else { block[0] = dcdiff * s->c_dc_scale; } i = 1; if (!a_avail && !c_avail) use_pred = 0; ac_val = s->ac_val[0][0] + s->block_index[n] * 16; ac_val2 = ac_val; scale = mquant * 2 + ((mquant == v->pq) ? v->halfpq : 0); if (dc_pred_dir) ac_val -= 16; else ac_val -= 16 * s->block_wrap[n]; q1 = s->current_picture.f.qscale_table[mb_pos]; if ( dc_pred_dir && c_avail && mb_pos) q2 = s->current_picture.f.qscale_table[mb_pos - 1]; if (!dc_pred_dir && a_avail && mb_pos >= s->mb_stride) q2 = s->current_picture.f.qscale_table[mb_pos - s->mb_stride]; if ( dc_pred_dir && n == 1) q2 = q1; if (!dc_pred_dir && n == 2) q2 = q1; if (n == 3) q2 = q1; if (coded) { int last = 0, skip, value; const uint8_t *zz_table; int k; if (v->s.ac_pred) { if (!use_pred && v->fcm == ILACE_FRAME) { zz_table = v->zzi_8x8; } else { if (!dc_pred_dir) zz_table = v->zz_8x8[2]; else zz_table = v->zz_8x8[3]; } } else { if (v->fcm != ILACE_FRAME) zz_table = v->zz_8x8[1]; else zz_table = v->zzi_8x8; } while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); i += skip; if (i > 63) break; block[zz_table[i++]] = value; } if (use_pred) { if (q2 && q1 != q2) { q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; if (dc_pred_dir) { for (k = 1; k < 8; k++) block[k << v->left_blk_sh] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } else { for (k = 1; k < 8; k++) block[k << v->top_blk_sh] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } else { if (dc_pred_dir) { for (k = 1; k < 8; k++) block[k << v->left_blk_sh] += ac_val[k]; } else { for (k = 1; k < 8; k++) block[k << v->top_blk_sh] += ac_val[k + 8]; } } } for (k = 1; k < 8; k++) { ac_val2[k ] = block[k << v->left_blk_sh]; ac_val2[k + 8] = block[k << v->top_blk_sh]; } for (k = 1; k < 64; k++) if (block[k]) { block[k] *= scale; if (!v->pquantizer) block[k] += (block[k] < 0) ? -mquant : mquant; } if (use_pred) i = 63; } else { int k; memset(ac_val2, 0, 16 * 2); if (dc_pred_dir) { if (use_pred) { memcpy(ac_val2, ac_val, 8 * 2); if (q2 && q1 != q2) { q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; for (k = 1; k < 8; k++) ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } } else { if (use_pred) { memcpy(ac_val2 + 8, ac_val + 8, 8 * 2); if (q2 && q1 != q2) { q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1; q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1; for (k = 1; k < 8; k++) ac_val2[k + 8] = (ac_val2[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } } if (use_pred) { if (dc_pred_dir) { for (k = 1; k < 8; k++) { block[k << v->left_blk_sh] = ac_val2[k] * scale; if (!v->pquantizer && block[k << v->left_blk_sh]) block[k << v->left_blk_sh] += (block[k << v->left_blk_sh] < 0) ? -mquant : mquant; } } else { for (k = 1; k < 8; k++) { block[k << v->top_blk_sh] = ac_val2[k + 8] * scale; if (!v->pquantizer && block[k << v->top_blk_sh]) block[k << v->top_blk_sh] += (block[k << v->top_blk_sh] < 0) ? -mquant : mquant; } } i = 63; } } s->block_last_index[n] = i; return 0; } libavcodec/vc1dec.c:2941: error: Buffer Overrun L2 Offset: [-oo, 66] (⇐ [1, 3] + [-oo, 63]) Size: 4. libavcodec/vc1dec.c:2937:13: <Offset trace> 2935. 2936. while (!last) { 2937. vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); ^ 2938. i += skip; 2939. if (i > 63) libavcodec/vc1dec.c:2937:13: Call 2935. 2936. while (!last) { 2937. vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); ^ 2938. i += skip; 2939. if (i > 63) libavcodec/vc1acdata.h:259:1: Array declaration 257. }; 258. 259. static const uint8_t vc1_index_decode_table[AC_MODES][185][2] = { ^ 260. { 261. { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8}, libavcodec/vc1dec.c:2613:9: Assignment 2611. index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset].table, AC_VLC_BITS, 3); 2612. if (index != vc1_ac_sizes[codingset] - 1) { 2613. run = vc1_index_decode_table[codingset][index][0]; ^ 2614. level = vc1_index_decode_table[codingset][index][1]; 2615. lst = index >= vc1_last_decode_table[codingset] || get_bits_left(gb) < 0; libavcodec/vc1dec.c:2660:5: Assignment 2658. 2659. *last = lst; 2660. *skip = run; ^ 2661. *value = level; 2662. } libavcodec/vc1dec.c:2938:13: Assignment 2936. while (!last) { 2937. vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); 2938. i += skip; ^ 2939. if (i > 63) 2940. break; libavcodec/vc1dec.c:2834:1: <Length trace> 2832. * @param mquant quantizer value for this macroblock 2833. */ 2834. static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, ^ 2835. int coded, int codingset, int mquant) 2836. { libavcodec/vc1dec.c:2834:1: Parameter `*v` 2832. * @param mquant quantizer value for this macroblock 2833. */ 2834. static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, ^ 2835. int coded, int codingset, int mquant) 2836. { libavcodec/vc1dec.c:2922:17: Assignment 2920. if (v->s.ac_pred) { 2921. if (!use_pred && v->fcm == ILACE_FRAME) { 2922. zz_table = v->zzi_8x8; ^ 2923. } else { 2924. if (!dc_pred_dir) // top libavcodec/vc1dec.c:2941:19: Array access: Offset: [-oo, 66] (⇐ [1, 3] + [-oo, 63]) Size: 4 2939. if (i > 63) 2940. break; 2941. block[zz_table[i++]] = value; ^ 2942. } 2943.
https://github.com/libav/libav/blob/39a7a5b8ab12bc75306f52e671dfb1497771553b/libavcodec/vc1dec.c/#L2941
d2a_code_trace_data_42774
static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, BN_CTX *ctx) { unsigned char *buf = NULL; int b, ret = 0, bit, bytes, mask; OPENSSL_CTX *libctx = bn_get_lib_ctx(ctx); if (bits == 0) { if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) goto toosmall; BN_zero(rnd); return 1; } if (bits < 0 || (bits == 1 && top > 0)) goto toosmall; bytes = (bits + 7) / 8; bit = (bits - 1) % 8; mask = 0xff << (bit + 1); buf = OPENSSL_malloc(bytes); if (buf == NULL) { BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); goto err; } b = flag == NORMAL ? rand_bytes_ex(libctx, buf, bytes) : rand_priv_bytes_ex(libctx, buf, bytes); if (b <= 0) goto err; if (flag == TESTING) { int i; unsigned char c; for (i = 0; i < bytes; i++) { if (rand_bytes_ex(libctx, &c, 1) <= 0) goto err; if (c >= 128 && i > 0) buf[i] = buf[i - 1]; else if (c < 42) buf[i] = 0; else if (c < 84) buf[i] = 255; } } if (top >= 0) { if (top) { if (bit == 0) { buf[0] = 1; buf[1] |= 0x80; } else { buf[0] |= (3 << (bit - 1)); } } else { buf[0] |= (1 << bit); } } buf[0] &= ~mask; if (bottom) buf[bytes - 1] |= 1; if (!BN_bin2bn(buf, bytes, rnd)) goto err; ret = 1; err: OPENSSL_clear_free(buf, bytes); bn_check_top(rnd); return ret; toosmall: BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL); return 0; } crypto/ec/ec2_smpl.c:699: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_priv_rand`. Showing all 14 steps of the trace crypto/ec/ec2_smpl.c:699:33: Call 697. /* s blinding: make sure lambda (s->Z here) is not zero */ 698. do { 699. if (!BN_priv_rand(s->Z, BN_num_bits(group->field) - 1, ^ 700. BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY)) { 701. ECerr(EC_F_EC_GF2M_SIMPLE_LADDER_PRE, ERR_R_BN_LIB); crypto/bn/bn_lib.c:141:9: Assignment 139. 140. if (BN_is_zero(a)) 141. return 0; ^ 142. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 143. } crypto/ec/ec2_smpl.c:699:14: Call 697. /* s blinding: make sure lambda (s->Z here) is not zero */ 698. do { 699. if (!BN_priv_rand(s->Z, BN_num_bits(group->field) - 1, ^ 700. BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY)) { 701. ECerr(EC_F_EC_GF2M_SIMPLE_LADDER_PRE, ERR_R_BN_LIB); crypto/bn/bn_rand.c:121:1: Parameter `bits` 119. } 120. 121. > int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom) 122. { 123. return bnrand(PRIVATE, rnd, bits, top, bottom, NULL); crypto/bn/bn_rand.c:123:12: Call 121. int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom) 122. { 123. return bnrand(PRIVATE, rnd, bits, top, bottom, NULL); ^ 124. } 125. crypto/bn/bn_rand.c:62:14: <Offset trace> 60. unsigned char c; 61. 62. for (i = 0; i < bytes; i++) { ^ 63. if (rand_bytes_ex(libctx, &c, 1) <= 0) 64. goto err; crypto/bn/bn_rand.c:62:14: Assignment 60. unsigned char c; 61. 62. for (i = 0; i < bytes; i++) { ^ 63. if (rand_bytes_ex(libctx, &c, 1) <= 0) 64. goto err; crypto/bn/bn_rand.c:23:1: <Length trace> 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_rand.c:23:1: Parameter `bits` 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_rand.c:39:5: Assignment 37. goto toosmall; 38. 39. bytes = (bits + 7) / 8; ^ 40. bit = (bits - 1) % 8; 41. mask = 0xff << (bit + 1); crypto/bn/bn_rand.c:43:11: Call 41. mask = 0xff << (bit + 1); 42. 43. buf = OPENSSL_malloc(bytes); ^ 44. if (buf == NULL) { 45. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/bn/bn_rand.c:43:5: Assignment 41. mask = 0xff << (bit + 1); 42. 43. buf = OPENSSL_malloc(bytes); ^ 44. if (buf == NULL) { 45. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/bn/bn_rand.c:88:9: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_priv_rand` 86. buf[0] &= ~mask; 87. if (bottom) /* set bottom bit if requested */ 88. buf[bytes - 1] |= 1; ^ 89. if (!BN_bin2bn(buf, bytes, rnd)) 90. goto err;
https://github.com/openssl/openssl/blob/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_rand.c/#L88
d2a_code_trace_data_42775
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, int max) { const unsigned char *p = *pp; unsigned long ret = 0; unsigned int i; if (max-- < 1) return (0); if (*p == 0x80) { *inf = 1; ret = 0; p++; } else { *inf = 0; i = *p & 0x7f; if (*(p++) & 0x80) { if (max < (int)i) return 0; while (i && *p == 0) { p++; i--; } if (i > sizeof(long)) return 0; while (i-- > 0) { ret <<= 8L; ret |= *(p++); } } else ret = i; } if (ret > LONG_MAX) return 0; *pp = p; *rl = (long)ret; return (1); } crypto/pkcs12/p12_decr.c:159: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] Size: [1, +oo] by call to `ASN1_item_d2i`. Showing all 23 steps of the trace crypto/pkcs12/p12_decr.c:140:10: Call 138. int outlen; 139. 140. if (!PKCS12_pbe_crypt(algor, pass, passlen, oct->data, oct->length, ^ 141. &out, &outlen, 0)) { 142. PKCS12err(PKCS12_F_PKCS12_ITEM_DECRYPT_D2I, crypto/pkcs12/p12_decr.c:73:1: Parameter `**data` 71. */ 72. 73. > unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, 74. int passlen, unsigned char *in, int inlen, 75. unsigned char **data, int *datalen, int en_de) crypto/pkcs12/p12_decr.c:146:5: Assignment 144. return NULL; 145. } 146. p = out; ^ 147. #ifdef OPENSSL_DEBUG_DECRYPT 148. { crypto/pkcs12/p12_decr.c:159:11: Call 157. } 158. #endif 159. ret = ASN1_item_d2i(NULL, &p, outlen, it); ^ 160. if (zbuf) 161. OPENSSL_cleanse(out, outlen); crypto/asn1/tasn_dec.c:143:1: Parameter `**in` 141. */ 142. 143. > ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, 144. const unsigned char **in, long len, 145. const ASN1_ITEM *it) crypto/asn1/tasn_dec.c:152:9: Call 150. pval = &ptmpval; 151. asn1_tlc_clear_nc(&c); 152. if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) ^ 153. return *pval; 154. return NULL; crypto/asn1/tasn_dec.c:157:1: Parameter `**in` 155. } 156. 157. > int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, 158. const ASN1_ITEM *it, 159. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:162:10: Call 160. { 161. int rv; 162. rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx); ^ 163. if (rv <= 0) 164. ASN1_item_ex_free(pval, it); crypto/asn1/tasn_dec.c:173:1: Parameter `**in` 171. */ 172. 173. > static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, 174. long len, const ASN1_ITEM *it, 175. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:217:9: Assignment 215. 216. case ASN1_ITYPE_MSTRING: 217. p = *in; ^ 218. /* Just read in tag and class */ 219. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, crypto/asn1/tasn_dec.c:219:15: Call 217. p = *in; 218. /* Just read in tag and class */ 219. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, ^ 220. &p, len, -1, 0, 1, ctx); 221. if (!ret) { crypto/asn1/tasn_dec.c:1096:1: Parameter `**in` 1094. */ 1095. 1096. > static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, 1097. char *inf, char *cst, 1098. const unsigned char **in, long len, crypto/asn1/tasn_dec.c:1105:5: Assignment 1103. long plen; 1104. const unsigned char *p, *q; 1105. p = *in; ^ 1106. q = p; 1107. crypto/asn1/tasn_dec.c:1115:13: Call 1113. p += ctx->hdrlen; 1114. } else { 1115. i = ASN1_get_object(&p, &plen, &ptag, &pclass, len); ^ 1116. if (ctx) { 1117. ctx->ret = i; crypto/asn1/asn1_lib.c:91:1: Parameter `**pp` 89. } 90. 91. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 92. int *pclass, long omax) 93. { crypto/asn1/asn1_lib.c:96:5: Assignment 94. int i, ret; 95. long l; 96. const unsigned char *p = *pp; ^ 97. int tag, xclass, inf; 98. long max = omax; crypto/asn1/asn1_lib.c:125:9: Assignment 123. } else { 124. tag = i; 125. p++; ^ 126. if (--max == 0) 127. goto err; crypto/asn1/asn1_lib.c:131:10: Call 129. *ptag = tag; 130. *pclass = xclass; 131. if (!asn1_get_length(&p, &inf, plength, (int)max)) ^ 132. goto err; 133. crypto/asn1/asn1_lib.c:152:1: <Length trace> 150. } 151. 152. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 153. int max) 154. { crypto/asn1/asn1_lib.c:152:1: Parameter `**pp` 150. } 151. 152. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 153. int max) 154. { crypto/asn1/asn1_lib.c:155:5: Assignment 153. int max) 154. { 155. const unsigned char *p = *pp; ^ 156. unsigned long ret = 0; 157. unsigned int i; crypto/asn1/asn1_lib.c:168:15: Assignment 166. *inf = 0; 167. i = *p & 0x7f; 168. if (*(p++) & 0x80) { ^ 169. if (max < (int)i) 170. return 0; crypto/asn1/asn1_lib.c:172:25: Array access: Offset: [2, +oo] Size: [1, +oo] by call to `ASN1_item_d2i` 170. return 0; 171. /* Skip leading zeroes */ 172. while (i && *p == 0) { ^ 173. p++; 174. i--;
https://github.com/openssl/openssl/blob/f325fba50c6e1cab053e449c420f76256b551867/crypto/asn1/asn1_lib.c/#L172
d2a_code_trace_data_42776
int X509_cmp_time(const ASN1_TIME *ctm, time_t *cmp_time) { char *str; ASN1_TIME atm; long offset; char buff1[24], buff2[24], *p; int i, j, remaining; p = buff1; remaining = ctm->length; str = (char *)ctm->data; if (ctm->type == V_ASN1_UTCTIME) { int min_length = sizeof("YYMMDDHHMMZ") - 1; int max_length = sizeof("YYMMDDHHMMSS+hhmm") - 1; if (remaining < min_length || remaining > max_length) return 0; memcpy(p, str, 10); p += 10; str += 10; remaining -= 10; } else { int min_length = sizeof("YYYYMMDDHHMMZ") - 1; int max_length = sizeof("YYYYMMDDHHMMSS.fff+hhmm") - 1; if (remaining < min_length || remaining > max_length) return 0; memcpy(p, str, 12); p += 12; str += 12; remaining -= 12; } if ((*str == 'Z') || (*str == '-') || (*str == '+')) { *(p++) = '0'; *(p++) = '0'; } else { if (remaining < 2) return 0; *(p++) = *(str++); *(p++) = *(str++); remaining -= 2; if (remaining && *str == '.') { str++; remaining--; for (i = 0; i < 3 && remaining; i++, str++, remaining--) { if (*str < '0' || *str > '9') break; } } } *(p++) = 'Z'; *(p++) = '\0'; if (!remaining) return 0; if (*str == 'Z') { if (remaining != 1) return 0; offset = 0; } else { if ((*str != '+') && (*str != '-')) return 0; if (remaining != 5) return 0; if (str[1] < '0' || str[1] > '9' || str[2] < '0' || str[2] > '9' || str[3] < '0' || str[3] > '9' || str[4] < '0' || str[4] > '9') return 0; offset = ((str[1] - '0') * 10 + (str[2] - '0')) * 60; offset += (str[3] - '0') * 10 + (str[4] - '0'); if (*str == '-') offset = -offset; } atm.type = ctm->type; atm.flags = 0; atm.length = sizeof(buff2); atm.data = (unsigned char *)buff2; if (X509_time_adj(&atm, offset * 60, cmp_time) == NULL) return 0; if (ctm->type == V_ASN1_UTCTIME) { i = (buff1[0] - '0') * 10 + (buff1[1] - '0'); if (i < 50) i += 100; j = (buff2[0] - '0') * 10 + (buff2[1] - '0'); if (j < 50) j += 100; if (i < j) return -1; if (i > j) return 1; } i = strcmp(buff1, buff2); if (i == 0) return -1; else return i; } crypto/x509/x509_vfy.c:1856: error: UNINITIALIZED_VALUE The value read from buff2[_] was never initialized. Showing all 1 steps of the trace crypto/x509/x509_vfy.c:1856:9: 1854. if (i < 50) 1855. i += 100; /* cf. RFC 2459 */ 1856. > j = (buff2[0] - '0') * 10 + (buff2[1] - '0'); 1857. if (j < 50) 1858. j += 100;
https://github.com/openssl/openssl/blob/b169c0ec40408566270fb638bcbfab01a0d2dc60/crypto/x509/x509_vfy.c/#L1856
d2a_code_trace_data_42777
int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, size_t *written) { int i; SSL3_BUFFER *wb = s->rlayer.wbuf; size_t currbuf = 0; size_t tmpwrit = 0; if ((s->rlayer.wpend_tot > len) || (!(s->mode & SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER) && (s->rlayer.wpend_buf != buf)) || (s->rlayer.wpend_type != type)) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_WRITE_PENDING, SSL_R_BAD_WRITE_RETRY); return -1; } for (;;) { if (SSL3_BUFFER_get_left(&wb[currbuf]) == 0 && currbuf < s->rlayer.numwpipes - 1) { currbuf++; continue; } clear_sys_error(); if (s->wbio != NULL) { s->rwstate = SSL_WRITING; i = BIO_write(s->wbio, (char *) &(SSL3_BUFFER_get_buf(&wb[currbuf]) [SSL3_BUFFER_get_offset(&wb[currbuf])]), (unsigned int)SSL3_BUFFER_get_left(&wb[currbuf])); if (i >= 0) tmpwrit = i; } else { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_WRITE_PENDING, SSL_R_BIO_NOT_SET); i = -1; } if (i > 0 && tmpwrit == SSL3_BUFFER_get_left(&wb[currbuf])) { SSL3_BUFFER_set_left(&wb[currbuf], 0); SSL3_BUFFER_add_offset(&wb[currbuf], tmpwrit); if (currbuf + 1 < s->rlayer.numwpipes) continue; s->rwstate = SSL_NOTHING; *written = s->rlayer.wpend_ret; return 1; } else if (i <= 0) { if (SSL_IS_DTLS(s)) { SSL3_BUFFER_set_left(&wb[currbuf], 0); } return i; } SSL3_BUFFER_add_offset(&wb[currbuf], tmpwrit); SSL3_BUFFER_sub_left(&wb[currbuf], tmpwrit); } } ssl/record/rec_layer_d1.c:424: error: INTEGER_OVERFLOW_L2 ([0, max(1, `s->rlayer.numwpipes`)] - 1):unsigned64 by call to `dtls1_read_failed`. Showing all 25 steps of the trace ssl/record/rec_layer_d1.c:340:1: Parameter `s->rlayer.numwpipes` 338. * none of our business 339. */ 340. > int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf, 341. size_t len, int peek, size_t *readbytes) 342. { ssl/record/rec_layer_d1.c:411:9: Call 409. 410. /* Check for timeout */ 411. if (dtls1_handle_timeout(s) > 0) { ^ 412. goto start; 413. } else if (ossl_statem_in_error(s)) { ssl/d1_lib.c:389:1: Parameter `s->rlayer.numwpipes` 387. } 388. 389. > int dtls1_handle_timeout(SSL *s) 390. { 391. /* if no timer is expired, don't do anything */ ssl/record/rec_layer_d1.c:422:16: Call 420. || (s->rlayer.rstate == SSL_ST_READ_BODY)) { 421. RECORD_LAYER_set_numrpipes(&s->rlayer, 0); 422. iret = dtls1_get_record(s); ^ 423. if (iret <= 0) { 424. iret = dtls1_read_failed(s, iret); ssl/record/ssl3_record.c:1817:1: Parameter `s->rlayer.numwpipes` 1815. */ 1816. /* used only by dtls1_read_bytes */ 1817. > int dtls1_get_record(SSL *s) 1818. { 1819. int ssl_major, ssl_minor; ssl/record/ssl3_record.c:1835:10: Call 1833. * This is a non-blocking operation. 1834. */ 1835. if (!dtls1_process_buffered_records(s)) { ^ 1836. /* SSLfatal() already called */ 1837. return -1; ssl/record/rec_layer_d1.c:224:1: Parameter `s->rlayer.numwpipes` 222. &((s)->rlayer.d->unprocessed_rcds)) 223. 224. > int dtls1_process_buffered_records(SSL *s) 225. { 226. pitem *item; ssl/record/rec_layer_d1.c:424:20: Call 422. iret = dtls1_get_record(s); 423. if (iret <= 0) { 424. iret = dtls1_read_failed(s, iret); ^ 425. /* 426. * Anything other than a timeout is an error. SSLfatal() already ssl/statem/statem_dtls.c:968:1: Parameter `s->rlayer.numwpipes` 966. #endif 967. 968. > int dtls1_read_failed(SSL *s, int code) 969. { 970. if (code > 0) { ssl/statem/statem_dtls.c:990:12: Call 988. } 989. 990. return dtls1_handle_timeout(s); ^ 991. } 992. ssl/d1_lib.c:389:1: Parameter `s->rlayer.numwpipes` 387. } 388. 389. > int dtls1_handle_timeout(SSL *s) 390. { 391. /* if no timer is expired, don't do anything */ ssl/d1_lib.c:413:12: Call 411. dtls1_start_timer(s); 412. /* Calls SSLfatal() if required */ 413. return dtls1_retransmit_buffered_messages(s); ^ 414. } 415. ssl/statem/statem_dtls.c:1008:1: Parameter `s->rlayer.numwpipes` 1006. } 1007. 1008. > int dtls1_retransmit_buffered_messages(SSL *s) 1009. { 1010. pqueue *sent = s->d1->sent_messages; ssl/statem/statem_dtls.c:1020:13: Call 1018. for (item = pqueue_next(&iter); item != NULL; item = pqueue_next(&iter)) { 1019. frag = (hm_fragment *)item->data; 1020. if (dtls1_retransmit_message(s, (unsigned short) ^ 1021. dtls1_get_queue_priority 1022. (frag->msg_header.seq, ssl/statem/statem_dtls.c:1097:1: Parameter `s->rlayer.numwpipes` 1095. } 1096. 1097. > int dtls1_retransmit_message(SSL *s, unsigned short seq, int *found) 1098. { 1099. int ret; ssl/statem/statem_dtls.c:1155:11: Call 1153. saved_retransmit_state.epoch); 1154. 1155. ret = dtls1_do_write(s, frag->msg_header.is_ccs ? ^ 1156. SSL3_RT_CHANGE_CIPHER_SPEC : SSL3_RT_HANDSHAKE); 1157. ssl/statem/statem_dtls.c:112:1: Parameter `s->rlayer.numwpipes` 110. * SSL3_RT_CHANGE_CIPHER_SPEC) 111. */ 112. > int dtls1_do_write(SSL *s, int type) 113. { 114. int ret; ssl/statem/statem_dtls.c:242:15: Call 240. } 241. 242. ret = dtls1_write_bytes(s, type, &s->init_buf->data[s->init_off], len, ^ 243. &written); 244. if (ret < 0) { ssl/record/rec_layer_d1.c:752:1: Parameter `s->rlayer.numwpipes` 750. * not all data has been sent or non-blocking IO. 751. */ 752. > int dtls1_write_bytes(SSL *s, int type, const void *buf, size_t len, 753. size_t *written) 754. { ssl/record/rec_layer_d1.c:763:9: Call 761. } 762. s->rwstate = SSL_NOTHING; 763. i = do_dtls1_write(s, type, buf, len, 0, written); ^ 764. return i; 765. } ssl/record/rec_layer_d1.c:767:1: Parameter `s->rlayer.numwpipes` 765. } 766. 767. > int do_dtls1_write(SSL *s, int type, const unsigned char *buf, 768. size_t len, int create_empty_fragment, size_t *written) 769. { ssl/record/rec_layer_d1.c:976:12: Call 974. 975. /* we now just need to write the buffer. Calls SSLfatal() as required. */ 976. return ssl3_write_pending(s, type, buf, len, written); ^ 977. } 978. ssl/record/rec_layer_s3.c:1113:1: <LHS trace> 1111. * Return values are as per SSL_write() 1112. */ 1113. > int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, 1114. size_t *written) 1115. { ssl/record/rec_layer_s3.c:1113:1: Parameter `s->rlayer.numwpipes` 1111. * Return values are as per SSL_write() 1112. */ 1113. > int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, 1114. size_t *written) 1115. { ssl/record/rec_layer_s3.c:1133:16: Binary operation: ([0, max(1, s->rlayer.numwpipes)] - 1):unsigned64 by call to `dtls1_read_failed` 1131. /* Loop until we find a buffer we haven't written out yet */ 1132. if (SSL3_BUFFER_get_left(&wb[currbuf]) == 0 1133. && currbuf < s->rlayer.numwpipes - 1) { ^ 1134. currbuf++; 1135. continue;
https://github.com/openssl/openssl/blob/148796291e47ad402ddfd1bbe6f34a2652657ec2/ssl/record/rec_layer_s3.c/#L1133
d2a_code_trace_data_42778
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecp_smpl.c:1050: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`. Showing all 10 steps of the trace crypto/ec/ecp_smpl.c:976:5: Call 974. } 975. 976. BN_CTX_start(ctx); ^ 977. rh = BN_CTX_get(ctx); 978. 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/ec/ecp_smpl.c:1050:5: Call 1048. 1049. err: 1050. BN_CTX_end(ctx); ^ 1051. BN_CTX_free(new_ctx); 1052. return ret; crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_42779
static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest, X509 *x, X509 *xca, EVP_PKEY *pkey, STACK_OF(OPENSSL_STRING) *sigopts, char *serialfile, int create, int days, int clrext, CONF *conf, char *section, ASN1_INTEGER *sno) { int ret=0; ASN1_INTEGER *bs=NULL; X509_STORE_CTX xsc; EVP_PKEY *upkey; upkey = X509_get_pubkey(xca); EVP_PKEY_copy_parameters(upkey,pkey); EVP_PKEY_free(upkey); if(!X509_STORE_CTX_init(&xsc,ctx,x,NULL)) { BIO_printf(bio_err,"Error initialising X509 store\n"); goto end; } if (sno) bs = sno; else if (!(bs = x509_load_serial(CAfile, serialfile, create))) goto end; X509_STORE_CTX_set_cert(&xsc,x); X509_STORE_CTX_set_flags(&xsc, X509_V_FLAG_CHECK_SS_SIGNATURE); if (!reqfile && X509_verify_cert(&xsc) <= 0) goto end; if (!X509_check_private_key(xca,pkey)) { BIO_printf(bio_err,"CA certificate and CA private key do not match\n"); goto end; } if (!X509_set_issuer_name(x,X509_get_subject_name(xca))) goto end; if (!X509_set_serialNumber(x,bs)) goto end; if (X509_gmtime_adj(X509_get_notBefore(x),0L) == NULL) goto end; if (X509_time_adj_ex(X509_get_notAfter(x),days, 0, NULL) == NULL) goto end; if (clrext) { while (X509_get_ext_count(x) > 0) X509_delete_ext(x, 0); } if (conf) { X509V3_CTX ctx2; X509_set_version(x,2); X509V3_set_ctx(&ctx2, xca, x, NULL, NULL, 0); X509V3_set_nconf(&ctx2, conf); if (!X509V3_EXT_add_nconf(conf, &ctx2, section, x)) goto end; } if (!do_X509_sign(bio_err, x, pkey, digest, sigopts)) goto end; ret=1; end: X509_STORE_CTX_cleanup(&xsc); if (!ret) ERR_print_errors(bio_err); if (!sno) ASN1_INTEGER_free(bs); return ret; } apps/x509.c:1200: error: NULL_DEREFERENCE pointer `upkey` last assigned on line 1199 could be null and is dereferenced by call to `EVP_PKEY_copy_parameters()` at line 1200, column 2. Showing all 19 steps of the trace apps/x509.c:1187:1: start of procedure x509_certify() 1185. } 1186. 1187. > static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest, 1188. X509 *x, X509 *xca, EVP_PKEY *pkey, 1189. STACK_OF(OPENSSL_STRING) *sigopts, apps/x509.c:1194:2: 1192. ASN1_INTEGER *sno) 1193. { 1194. > int ret=0; 1195. ASN1_INTEGER *bs=NULL; 1196. X509_STORE_CTX xsc; apps/x509.c:1195:2: 1193. { 1194. int ret=0; 1195. > ASN1_INTEGER *bs=NULL; 1196. X509_STORE_CTX xsc; 1197. EVP_PKEY *upkey; apps/x509.c:1199:2: 1197. EVP_PKEY *upkey; 1198. 1199. > upkey = X509_get_pubkey(xca); 1200. EVP_PKEY_copy_parameters(upkey,pkey); 1201. EVP_PKEY_free(upkey); crypto/x509/x509_cmp.c:300:1: start of procedure X509_get_pubkey() 298. } 299. 300. > EVP_PKEY *X509_get_pubkey(X509 *x) 301. { 302. if ((x == NULL) || (x->cert_info == NULL)) crypto/x509/x509_cmp.c:302:7: Taking false branch 300. EVP_PKEY *X509_get_pubkey(X509 *x) 301. { 302. if ((x == NULL) || (x->cert_info == NULL)) ^ 303. return(NULL); 304. return(X509_PUBKEY_get(x->cert_info->key)); crypto/x509/x509_cmp.c:302:22: Taking false branch 300. EVP_PKEY *X509_get_pubkey(X509 *x) 301. { 302. if ((x == NULL) || (x->cert_info == NULL)) ^ 303. return(NULL); 304. return(X509_PUBKEY_get(x->cert_info->key)); crypto/x509/x509_cmp.c:304:2: 302. if ((x == NULL) || (x->cert_info == NULL)) 303. return(NULL); 304. > return(X509_PUBKEY_get(x->cert_info->key)); 305. } 306. crypto/asn1/x_pubkey.c:133:1: start of procedure X509_PUBKEY_get() 131. } 132. 133. > EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) 134. { 135. EVP_PKEY *ret=NULL; crypto/asn1/x_pubkey.c:135:2: 133. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) 134. { 135. > EVP_PKEY *ret=NULL; 136. 137. if (key == NULL) goto error; crypto/asn1/x_pubkey.c:137:6: Taking false branch 135. EVP_PKEY *ret=NULL; 136. 137. if (key == NULL) goto error; ^ 138. 139. if (key->pkey != NULL) crypto/asn1/x_pubkey.c:139:6: Taking false branch 137. if (key == NULL) goto error; 138. 139. if (key->pkey != NULL) ^ 140. { 141. CRYPTO_add(&key->pkey->references, 1, CRYPTO_LOCK_EVP_PKEY); crypto/asn1/x_pubkey.c:145:6: Taking true branch 143. } 144. 145. if (key->public_key == NULL) goto error; ^ 146. 147. if ((ret = EVP_PKEY_new()) == NULL) crypto/asn1/x_pubkey.c:191:2: 189. return ret; 190. 191. > error: 192. if (ret != NULL) 193. EVP_PKEY_free(ret); crypto/asn1/x_pubkey.c:192:6: Taking false branch 190. 191. error: 192. if (ret != NULL) ^ 193. EVP_PKEY_free(ret); 194. return(NULL); crypto/asn1/x_pubkey.c:194:2: 192. if (ret != NULL) 193. EVP_PKEY_free(ret); 194. > return(NULL); 195. } 196. crypto/asn1/x_pubkey.c:195:2: return from a call to X509_PUBKEY_get 193. EVP_PKEY_free(ret); 194. return(NULL); 195. } ^ 196. 197. /* Now two pseudo ASN1 routines that take an EVP_PKEY structure crypto/x509/x509_cmp.c:305:2: return from a call to X509_get_pubkey 303. return(NULL); 304. return(X509_PUBKEY_get(x->cert_info->key)); 305. } ^ 306. 307. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x) apps/x509.c:1200:2: 1198. 1199. upkey = X509_get_pubkey(xca); 1200. > EVP_PKEY_copy_parameters(upkey,pkey); 1201. EVP_PKEY_free(upkey); 1202.
https://github.com/openssl/openssl/blob/360ef6769e97f2918ae67a2909951eb8612043ee/apps/x509.c/#L1200
d2a_code_trace_data_42780
int ERR_set_mark(void) { ERR_STATE *es; es = ERR_get_state(); if (es == NULL) return 0; if (es->bottom == es->top) return 0; es->err_flags[es->top] |= ERR_FLAG_MARK; return 1; } crypto/err/err.c:775: error: MEMORY_LEAK memory dynamically allocated to `return` by call to `ERR_get_state()` at line 770, column 10 is not reachable after line 775, column 9. Showing all 49 steps of the trace crypto/err/err.c:766:1: start of procedure ERR_set_mark() 764. } 765. 766. > int ERR_set_mark(void) 767. { 768. ERR_STATE *es; crypto/err/err.c:770:5: 768. ERR_STATE *es; 769. 770. > es = ERR_get_state(); 771. if (es == NULL) 772. return 0; crypto/err/err.c:662:1: start of procedure ERR_get_state() 660. } 661. 662. > ERR_STATE *ERR_get_state(void) 663. { 664. ERR_STATE *state = NULL; crypto/err/err.c:664:5: 662. ERR_STATE *ERR_get_state(void) 663. { 664. > ERR_STATE *state = NULL; 665. 666. if (!RUN_ONCE(&err_init, err_do_init)) crypto/err/err.c:666:10: 664. ERR_STATE *state = NULL; 665. 666. > if (!RUN_ONCE(&err_init, err_do_init)) 667. return NULL; 668. crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once() 103. } 104. 105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) crypto/threads_pthread.c:107:9: Taking false branch 105. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) ^ 108. return 0; 109. crypto/threads_pthread.c:110:5: 108. return 0; 109. 110. > return 1; 111. } 112. crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once 109. 110. return 1; 111. > } 112. 113. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/err/err.c:666:10: Condition is true 664. ERR_STATE *state = NULL; 665. 666. if (!RUN_ONCE(&err_init, err_do_init)) ^ 667. return NULL; 668. crypto/err/err.c:666:10: Taking false branch 664. ERR_STATE *state = NULL; 665. 666. if (!RUN_ONCE(&err_init, err_do_init)) ^ 667. return NULL; 668. crypto/err/err.c:674:10: Taking false branch 672. * Needed on any platform that doesn't define OPENSSL_USE_NODELETE. 673. */ 674. if (!OPENSSL_init_crypto(0, NULL)) ^ 675. return NULL; 676. crypto/err/err.c:677:5: 675. return NULL; 676. 677. > state = CRYPTO_THREAD_get_local(&err_thread_local); 678. 679. if (state == NULL) { crypto/threads_pthread.c:121:1: start of procedure CRYPTO_THREAD_get_local() 119. } 120. 121. > void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 122. { 123. return pthread_getspecific(*key); crypto/threads_pthread.c:123:5: Skipping pthread_getspecific(): method has no implementation 121. void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 122. { 123. return pthread_getspecific(*key); ^ 124. } 125. crypto/threads_pthread.c:124:1: return from a call to CRYPTO_THREAD_get_local 122. { 123. return pthread_getspecific(*key); 124. > } 125. 126. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) crypto/err/err.c:679:9: Taking true branch 677. state = CRYPTO_THREAD_get_local(&err_thread_local); 678. 679. if (state == NULL) { ^ 680. state = OPENSSL_zalloc(sizeof(*state)); 681. if (state == NULL) crypto/err/err.c:680:9: 678. 679. if (state == NULL) { 680. > state = OPENSSL_zalloc(sizeof(*state)); 681. if (state == NULL) 682. return NULL; 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/err/err.c:681:13: Taking false branch 679. if (state == NULL) { 680. state = OPENSSL_zalloc(sizeof(*state)); 681. if (state == NULL) ^ 682. return NULL; 683. crypto/err/err.c:684:14: Taking false branch 682. return NULL; 683. 684. if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE) ^ 685. || !CRYPTO_THREAD_set_local(&err_thread_local, state)) { 686. ERR_STATE_free(state); crypto/err/err.c:685:17: 683. 684. if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE) 685. > || !CRYPTO_THREAD_set_local(&err_thread_local, state)) { 686. ERR_STATE_free(state); 687. return NULL; crypto/threads_pthread.c:126:1: start of procedure CRYPTO_THREAD_set_local() 124. } 125. 126. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 127. { 128. if (pthread_setspecific(*key, val) != 0) crypto/threads_pthread.c:128:9: Taking false branch 126. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 127. { 128. if (pthread_setspecific(*key, val) != 0) ^ 129. return 0; 130. crypto/threads_pthread.c:131:5: 129. return 0; 130. 131. > return 1; 132. } 133. crypto/threads_pthread.c:132:1: return from a call to CRYPTO_THREAD_set_local 130. 131. return 1; 132. > } 133. 134. int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key) crypto/err/err.c:685:17: Taking false branch 683. 684. if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE) 685. || !CRYPTO_THREAD_set_local(&err_thread_local, state)) { ^ 686. ERR_STATE_free(state); 687. return NULL; crypto/err/err.c:691:9: Skipping OPENSSL_init_crypto(): empty list of specs 689. 690. /* Ignore failures from these */ 691. OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL); ^ 692. } 693. crypto/err/err.c:694:5: 692. } 693. 694. > return state; 695. } 696. crypto/err/err.c:695:1: return from a call to ERR_get_state 693. 694. return state; 695. > } 696. 697. int ERR_get_next_error_library(void) crypto/err/err.c:771:9: Taking false branch 769. 770. es = ERR_get_state(); 771. if (es == NULL) ^ 772. return 0; 773. crypto/err/err.c:774:9: Taking true branch 772. return 0; 773. 774. if (es->bottom == es->top) ^ 775. return 0; 776. es->err_flags[es->top] |= ERR_FLAG_MARK; crypto/err/err.c:775:9: 773. 774. if (es->bottom == es->top) 775. > return 0; 776. es->err_flags[es->top] |= ERR_FLAG_MARK; 777. return 1;
https://github.com/openssl/openssl/blob/f770d75b1cac264d6280ec7326277daff6965cbb/crypto/err/err.c/#L775
d2a_code_trace_data_42781
size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) { int len = strlen(dst); va_list vl; va_start(vl, fmt); len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); va_end(vl); return len; } libavformat/http.c:619: error: Integer Overflow R2 ([0, +oo] + [0, +oo]):signed32 by call to `av_strlcatf`. libavformat/http.c:541:5: Array declaration 539. HTTPContext *s = h->priv_data; 540. int post, err; 541. char headers[HTTP_HEADERS_SIZE] = ""; ^ 542. char *authstr = NULL, *proxyauthstr = NULL; 543. int64_t off = s->off; libavformat/http.c:619:16: Call 617. 618. if (!has_header(s->headers, "\r\nContent-Type: ") && s->content_type) 619. len += av_strlcatf(headers + len, sizeof(headers) - len, ^ 620. "Content-Type: %s\r\n", s->content_type); 621. if (!has_header(s->headers, "\r\nIcy-MetaData: ") && s->icy) libavutil/avstring.c:99:1: <LHS trace> 97. } 98. 99. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) ^ 100. { 101. int len = strlen(dst); libavutil/avstring.c:99:1: Parameter `size` 97. } 98. 99. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) ^ 100. { 101. int len = strlen(dst); libavutil/avstring.c:105:12: <RHS trace> 103. 104. va_start(vl, fmt); 105. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); ^ 106. va_end(vl); 107. libavutil/avstring.c:105:12: Risky value from: vsnprintf 103. 104. va_start(vl, fmt); 105. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); ^ 106. va_end(vl); 107. libavutil/avstring.c:105:5: Binary operation: ([0, +oo] + [0, +oo]):signed32 by call to `av_strlcatf` 103. 104. va_start(vl, fmt); 105. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); ^ 106. va_end(vl); 107.
https://github.com/libav/libav/blob/436ced244fadcde2c0b925627920e84b25482542/libavutil/avstring.c/#L105
d2a_code_trace_data_42782
static void dct32(INTFLOAT *out, const INTFLOAT *tab) { INTFLOAT tmp0, tmp1; INTFLOAT val0 , val1 , val2 , val3 , val4 , val5 , val6 , val7 , val8 , val9 , val10, val11, val12, val13, val14, val15, val16, val17, val18, val19, val20, val21, val22, val23, val24, val25, val26, val27, val28, val29, val30, val31; BF0( 0, 31, COS0_0 , 1); BF0(15, 16, COS0_15, 5); BF( 0, 15, COS1_0 , 1); BF(16, 31,-COS1_0 , 1); BF0( 7, 24, COS0_7 , 1); BF0( 8, 23, COS0_8 , 1); BF( 7, 8, COS1_7 , 4); BF(23, 24,-COS1_7 , 4); BF( 0, 7, COS2_0 , 1); BF( 8, 15,-COS2_0 , 1); BF(16, 23, COS2_0 , 1); BF(24, 31,-COS2_0 , 1); BF0( 3, 28, COS0_3 , 1); BF0(12, 19, COS0_12, 2); BF( 3, 12, COS1_3 , 1); BF(19, 28,-COS1_3 , 1); BF0( 4, 27, COS0_4 , 1); BF0(11, 20, COS0_11, 2); BF( 4, 11, COS1_4 , 1); BF(20, 27,-COS1_4 , 1); BF( 3, 4, COS2_3 , 3); BF(11, 12,-COS2_3 , 3); BF(19, 20, COS2_3 , 3); BF(27, 28,-COS2_3 , 3); BF( 0, 3, COS3_0 , 1); BF( 4, 7,-COS3_0 , 1); BF( 8, 11, COS3_0 , 1); BF(12, 15,-COS3_0 , 1); BF(16, 19, COS3_0 , 1); BF(20, 23,-COS3_0 , 1); BF(24, 27, COS3_0 , 1); BF(28, 31,-COS3_0 , 1); BF0( 1, 30, COS0_1 , 1); BF0(14, 17, COS0_14, 3); BF( 1, 14, COS1_1 , 1); BF(17, 30,-COS1_1 , 1); BF0( 6, 25, COS0_6 , 1); BF0( 9, 22, COS0_9 , 1); BF( 6, 9, COS1_6 , 2); BF(22, 25,-COS1_6 , 2); BF( 1, 6, COS2_1 , 1); BF( 9, 14,-COS2_1 , 1); BF(17, 22, COS2_1 , 1); BF(25, 30,-COS2_1 , 1); BF0( 2, 29, COS0_2 , 1); BF0(13, 18, COS0_13, 3); BF( 2, 13, COS1_2 , 1); BF(18, 29,-COS1_2 , 1); BF0( 5, 26, COS0_5 , 1); BF0(10, 21, COS0_10, 1); BF( 5, 10, COS1_5 , 2); BF(21, 26,-COS1_5 , 2); BF( 2, 5, COS2_2 , 1); BF(10, 13,-COS2_2 , 1); BF(18, 21, COS2_2 , 1); BF(26, 29,-COS2_2 , 1); BF( 1, 2, COS3_1 , 2); BF( 5, 6,-COS3_1 , 2); BF( 9, 10, COS3_1 , 2); BF(13, 14,-COS3_1 , 2); BF(17, 18, COS3_1 , 2); BF(21, 22,-COS3_1 , 2); BF(25, 26, COS3_1 , 2); BF(29, 30,-COS3_1 , 2); BF1( 0, 1, 2, 3); BF2( 4, 5, 6, 7); BF1( 8, 9, 10, 11); BF2(12, 13, 14, 15); BF1(16, 17, 18, 19); BF2(20, 21, 22, 23); BF1(24, 25, 26, 27); BF2(28, 29, 30, 31); ADD( 8, 12); ADD(12, 10); ADD(10, 14); ADD(14, 9); ADD( 9, 13); ADD(13, 11); ADD(11, 15); out[ 0] = val0; out[16] = val1; out[ 8] = val2; out[24] = val3; out[ 4] = val4; out[20] = val5; out[12] = val6; out[28] = val7; out[ 2] = val8; out[18] = val9; out[10] = val10; out[26] = val11; out[ 6] = val12; out[22] = val13; out[14] = val14; out[30] = val15; ADD(24, 28); ADD(28, 26); ADD(26, 30); ADD(30, 25); ADD(25, 29); ADD(29, 27); ADD(27, 31); out[ 1] = val16 + val24; out[17] = val17 + val25; out[ 9] = val18 + val26; out[25] = val19 + val27; out[ 5] = val20 + val28; out[21] = val21 + val29; out[13] = val22 + val30; out[29] = val23 + val31; out[ 3] = val24 + val20; out[19] = val25 + val21; out[11] = val26 + val22; out[27] = val27 + val23; out[ 7] = val28 + val18; out[23] = val29 + val19; out[15] = val30 + val17; out[31] = val31; } libavcodec/mpc.c:54: error: Buffer Overrun L2 Offset: [8+min(0, `c->synth_buf_offset[*]`), 9+max(511, `c->synth_buf_offset[*]`)] (⇐ [min(0, `c->synth_buf_offset[*]`), 1+max(511, `c->synth_buf_offset[*]`)] + 8) Size: 2 by call to `ff_mpa_synth_filter`. libavcodec/mpc.c:45:1: Parameter `c->synth_buf[*]` 43. * Process decoded Musepack data and produce PCM 44. */ 45. static void mpc_synth(MPCContext *c, int16_t *out) ^ 46. { 47. int dither_state = 0; libavcodec/mpc.c:54:13: Call 52. samples_ptr = samples + ch; 53. for(i = 0; i < SAMPLES_PER_BAND; i++) { 54. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), ^ 55. ff_mpa_synth_window, &dither_state, 56. samples_ptr, 2, libavcodec/mpegaudiodec.c:705:1: Parameter `*synth_buf_ptr` 703. /* XXX: optimize by avoiding ring buffer usage */ 704. #if !CONFIG_FLOAT 705. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 706. MPA_INT *window, int *dither_state, 707. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:718:5: Assignment 716. 717. offset = *synth_buf_offset; 718. synth_buf = synth_buf_ptr + offset; ^ 719. 720. #if FRAC_BITS <= 15 libavcodec/mpegaudiodec.c:728:5: Call 726. } 727. #else 728. dct32(synth_buf, sb_samples); ^ 729. #endif 730. libavcodec/dct32.c:106:1: <Length trace> 104. 105. /* DCT32 without 1/sqrt(2) coef zero scaling. */ 106. static void dct32(INTFLOAT *out, const INTFLOAT *tab) ^ 107. { 108. INTFLOAT tmp0, tmp1; libavcodec/dct32.c:106:1: Parameter `*out` 104. 105. /* DCT32 without 1/sqrt(2) coef zero scaling. */ 106. static void dct32(INTFLOAT *out, const INTFLOAT *tab) ^ 107. { 108. INTFLOAT tmp0, tmp1; libavcodec/dct32.c:228:5: Array access: Offset: [8+min(0, c->synth_buf_offset[*]), 9+max(511, c->synth_buf_offset[*])] (⇐ [min(0, c->synth_buf_offset[*]), 1+max(511, c->synth_buf_offset[*])] + 8) Size: 2 by call to `ff_mpa_synth_filter` 226. out[ 0] = val0; 227. out[16] = val1; 228. out[ 8] = val2; ^ 229. out[24] = val3; 230. out[ 4] = val4;
https://github.com/libav/libav/blob/63e8d9760f23a4edf81e9ae58c4f6d3baa6ff4dd/libavcodec/dct32.c/#L228
d2a_code_trace_data_42783
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } test/srptest.c:150: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `SRP_create_verifier_BN`. Showing all 25 steps of the trace test/srptest.c:150:10: Call 148. BN_hex2bn(&s, "BEB25379D1A8581EB5A727673A2441EE"); 149. /* Set up server's password entry */ 150. if (!TEST_true(SRP_create_verifier_BN("alice", "password123", &s, &v, GN->N, ^ 151. GN->g))) 152. goto err; crypto/srp/srp_vfy.c:633:1: Parameter `g->top` 631. * BIGNUMS. 632. */ 633. > int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, 634. BIGNUM **verifier, const BIGNUM *N, 635. const BIGNUM *g) crypto/srp/srp_vfy.c:664:10: Call 662. goto err; 663. 664. if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) { ^ 665. BN_clear_free(*verifier); 666. goto err; crypto/bn/bn_exp.c:91:1: Parameter `a->top` 89. } 90. 91. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 92. BN_CTX *ctx) 93. { crypto/bn/bn_exp.c:144:19: Call 142. } else 143. # endif 144. ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL); ^ 145. } else 146. #endif crypto/bn/bn_exp.c:294:1: Parameter `a->top` 292. } 293. 294. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 295. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 296. { crypto/bn/bn_exp.c:306:16: Call 304. 305. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 306. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 307. } 308. crypto/bn/bn_exp.c:594:1: Parameter `a->top` 592. * http://www.daemonology.net/hyperthreading-considered-harmful/) 593. */ 594. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 595. const BIGNUM *m, BN_CTX *ctx, 596. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:751:17: Call 749. if (!BN_to_montgomery(&am, &am, mont, ctx)) 750. goto err; 751. } else if (!BN_to_montgomery(&am, a, mont, ctx)) ^ 752. goto err; 753. crypto/bn/bn_lib.c:877:1: Parameter `a->top` 875. } 876. 877. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 878. BN_CTX *ctx) 879. { crypto/bn/bn_lib.c:880:12: Call 878. BN_CTX *ctx) 879. { 880. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx); ^ 881. } 882. crypto/bn/bn_mont.c:26:1: Parameter `a->top` 24. #endif 25. 26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { crypto/bn/bn_mont.c:53:14: Call 51. bn_check_top(tmp); 52. if (a == b) { 53. if (!BN_sqr(tmp, a, ctx)) ^ 54. goto err; 55. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:105:1: <Offset trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `n` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:116:5: Assignment 114. rp[0] = rp[max - 1] = 0; 115. rp++; 116. j = n; ^ 117. 118. if (--j > 0) { crypto/bn/bn_sqr.c:118:9: Assignment 116. j = n; 117. 118. if (--j > 0) { ^ 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:105:1: <Length trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `*r` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:113:5: Assignment 111. max = n * 2; 112. ap = a; 113. rp = r; ^ 114. rp[0] = rp[max - 1] = 0; 115. rp++; crypto/bn/bn_sqr.c:115:5: Assignment 113. rp = r; 114. rp[0] = rp[max - 1] = 0; 115. rp++; ^ 116. j = n; 117. crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `SRP_create_verifier_BN` 118. if (--j > 0) { 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 121. rp += 2; 122. }
https://github.com/openssl/openssl/blob/6ea3bca427b3e759939a63555821d0c4678dd79c/crypto/bn/bn_sqr.c/#L120
d2a_code_trace_data_42784
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/sslcorrupttest.c:173: error: INTEGER_OVERFLOW_L2 ([0, 8] - 1):unsigned32 by call to `SSL_free`. Showing all 18 steps of the trace test/sslcorrupttest.c:147:10: Call 145. int i, j, numciphers = 0; 146. 147. if (!TEST_ptr(ctx = SSL_CTX_new(TLS_server_method())) ^ 148. || !TEST_ptr(ssl = SSL_new(ctx)) 149. || !TEST_ptr(sk_ciphers = SSL_get1_supported_ciphers(ssl))) ssl/ssl_lib.c:2652:21: Call 2650. goto err; 2651. 2652. ret->sessions = lh_SSL_SESSION_new(ssl_session_hash, ssl_session_cmp); ^ 2653. if (ret->sessions == NULL) 2654. goto err; ssl/ssl_locl.h:696:1: Call 694. } TLSEXT_INDEX; 695. 696. > DEFINE_LHASH_OF(SSL_SESSION); 697. /* Needed in ssl_cert.c */ 698. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:39:5: Assignment 37. ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c); 38. ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h); 39. ret->num_nodes = MIN_NODES / 2; ^ 40. ret->num_alloc_nodes = MIN_NODES; 41. ret->pmax = MIN_NODES / 2; test/sslcorrupttest.c:173:5: Call 171. err: 172. sk_SSL_CIPHER_free(sk_ciphers); 173. SSL_free(ssl); ^ 174. SSL_CTX_free(ctx); 175. ssl/ssl_lib.c:942:1: Parameter `s->ctx->sessions->num_nodes` 940. } 941. 942. > void SSL_free(SSL *s) 943. { 944. int i; ssl/ssl_lib.c:1011:5: Call 1009. RECORD_LAYER_release(&s->rlayer); 1010. 1011. SSL_CTX_free(s->ctx); ^ 1012. 1013. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:2769:1: Parameter `a->sessions->num_nodes` 2767. } 2768. 2769. > void SSL_CTX_free(SSL_CTX *a) 2770. { 2771. int i; ssl/ssl_lib.c:2795:9: Call 2793. */ 2794. if (a->sessions != NULL) 2795. SSL_CTX_flush_sessions(a, 0); ^ 2796. 2797. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:1025:1: Parameter `s->sessions->num_nodes` 1023. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1024. 1025. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 1026. { 1027. unsigned long i; ssl/ssl_sess.c:1038:5: Call 1036. i = lh_SSL_SESSION_get_down_load(s->sessions); 1037. lh_SSL_SESSION_set_down_load(s->sessions, 0); 1038. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 1039. lh_SSL_SESSION_set_down_load(s->sessions, i); 1040. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:1023:1: Parameter `lh->num_nodes` 1021. } 1022. 1023. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1024. 1025. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:1023:1: Call 1021. } 1022. 1023. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1024. 1025. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:186:1: Parameter `lh->num_nodes` 184. } 185. 186. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 187. { 188. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:188:5: Call 186. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 187. { 188. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 189. } 190. crypto/lhash/lhash.c:154:1: <LHS trace> 152. } 153. 154. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 155. OPENSSL_LH_DOALL_FUNC func, 156. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:154:1: Parameter `lh->num_nodes` 152. } 153. 154. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 155. OPENSSL_LH_DOALL_FUNC func, 156. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:168:10: Binary operation: ([0, 8] - 1):unsigned32 by call to `SSL_free` 166. * memory leaks otherwise 167. */ 168. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 169. a = lh->b[i]; 170. while (a != NULL) {
https://github.com/openssl/openssl/blob/25ffeb11ea86bdc76db150c504550602a9acc9bc/crypto/lhash/lhash.c/#L168
d2a_code_trace_data_42785
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, long max) { const unsigned char *p = *pp; unsigned long ret = 0; unsigned long i; if (max-- < 1) return 0; if (*p == 0x80) { *inf = 1; ret = 0; p++; } else { *inf = 0; i = *p & 0x7f; if (*(p++) & 0x80) { if (max < (long)i + 1) return 0; while (i && *p == 0) { p++; i--; } if (i > sizeof(long)) return 0; while (i-- > 0) { ret <<= 8L; ret |= *(p++); } } else ret = i; } if (ret > LONG_MAX) return 0; *pp = p; *rl = (long)ret; return 1; } crypto/pkcs12/p12_decr.c:159: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] Size: [1, +oo] by call to `ASN1_item_d2i`. Showing all 23 steps of the trace crypto/pkcs12/p12_decr.c:140:10: Call 138. int outlen; 139. 140. if (!PKCS12_pbe_crypt(algor, pass, passlen, oct->data, oct->length, ^ 141. &out, &outlen, 0)) { 142. PKCS12err(PKCS12_F_PKCS12_ITEM_DECRYPT_D2I, crypto/pkcs12/p12_decr.c:73:1: Parameter `**data` 71. */ 72. 73. > unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, 74. int passlen, unsigned char *in, int inlen, 75. unsigned char **data, int *datalen, int en_de) crypto/pkcs12/p12_decr.c:146:5: Assignment 144. return NULL; 145. } 146. p = out; ^ 147. #ifdef OPENSSL_DEBUG_DECRYPT 148. { crypto/pkcs12/p12_decr.c:159:11: Call 157. } 158. #endif 159. ret = ASN1_item_d2i(NULL, &p, outlen, it); ^ 160. if (zbuf) 161. OPENSSL_cleanse(out, outlen); crypto/asn1/tasn_dec.c:143:1: Parameter `**in` 141. */ 142. 143. > ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, 144. const unsigned char **in, long len, 145. const ASN1_ITEM *it) crypto/asn1/tasn_dec.c:152:9: Call 150. pval = &ptmpval; 151. asn1_tlc_clear_nc(&c); 152. if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) ^ 153. return *pval; 154. return NULL; crypto/asn1/tasn_dec.c:157:1: Parameter `**in` 155. } 156. 157. > int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, 158. const ASN1_ITEM *it, 159. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:162:10: Call 160. { 161. int rv; 162. rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx); ^ 163. if (rv <= 0) 164. ASN1_item_ex_free(pval, it); crypto/asn1/tasn_dec.c:173:1: Parameter `**in` 171. */ 172. 173. > static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, 174. long len, const ASN1_ITEM *it, 175. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:217:9: Assignment 215. 216. case ASN1_ITYPE_MSTRING: 217. p = *in; ^ 218. /* Just read in tag and class */ 219. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, crypto/asn1/tasn_dec.c:219:15: Call 217. p = *in; 218. /* Just read in tag and class */ 219. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, ^ 220. &p, len, -1, 0, 1, ctx); 221. if (!ret) { crypto/asn1/tasn_dec.c:1096:1: Parameter `**in` 1094. */ 1095. 1096. > static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, 1097. char *inf, char *cst, 1098. const unsigned char **in, long len, crypto/asn1/tasn_dec.c:1105:5: Assignment 1103. long plen; 1104. const unsigned char *p, *q; 1105. p = *in; ^ 1106. q = p; 1107. crypto/asn1/tasn_dec.c:1115:13: Call 1113. p += ctx->hdrlen; 1114. } else { 1115. i = ASN1_get_object(&p, &plen, &ptag, &pclass, len); ^ 1116. if (ctx) { 1117. ctx->ret = i; crypto/asn1/asn1_lib.c:91:1: Parameter `**pp` 89. } 90. 91. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 92. int *pclass, long omax) 93. { crypto/asn1/asn1_lib.c:96:5: Assignment 94. int i, ret; 95. long l; 96. const unsigned char *p = *pp; ^ 97. int tag, xclass, inf; 98. long max = omax; crypto/asn1/asn1_lib.c:125:9: Assignment 123. } else { 124. tag = i; 125. p++; ^ 126. if (--max == 0) 127. goto err; crypto/asn1/asn1_lib.c:131:10: Call 129. *ptag = tag; 130. *pclass = xclass; 131. if (!asn1_get_length(&p, &inf, plength, max)) ^ 132. goto err; 133. crypto/asn1/asn1_lib.c:152:1: <Length trace> 150. } 151. 152. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 153. long max) 154. { crypto/asn1/asn1_lib.c:152:1: Parameter `**pp` 150. } 151. 152. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 153. long max) 154. { crypto/asn1/asn1_lib.c:155:5: Assignment 153. long max) 154. { 155. const unsigned char *p = *pp; ^ 156. unsigned long ret = 0; 157. unsigned long i; crypto/asn1/asn1_lib.c:168:15: Assignment 166. *inf = 0; 167. i = *p & 0x7f; 168. if (*(p++) & 0x80) { ^ 169. if (max < (long)i + 1) 170. return 0; crypto/asn1/asn1_lib.c:172:25: Array access: Offset: [2, +oo] Size: [1, +oo] by call to `ASN1_item_d2i` 170. return 0; 171. /* Skip leading zeroes */ 172. while (i && *p == 0) { ^ 173. p++; 174. i--;
https://github.com/openssl/openssl/blob/79c7f74d6cefd5d32fa20e69195ad3de834ce065/crypto/asn1/asn1_lib.c/#L172
d2a_code_trace_data_42786
static int append_buf(char **buf, int *size, const char *s) { const int expand = 256; int len = strlen(s) + 1; char *p = *buf; if (p == NULL) { *size = ((len + expand - 1) / expand) * expand; p = *buf = app_malloc(*size, "engine buffer"); } else { const int blen = strlen(p); if (blen > 0) len += 2 + blen; if (len > *size) { *size = ((len + expand - 1) / expand) * expand; p = OPENSSL_realloc(p, *size); if (p == NULL) { OPENSSL_free(*buf); *buf = NULL; return 0; } *buf = p; } if (blen > 0) { p += blen; *p++ = ','; *p++ = ' '; } } strcpy(p, s); return 1; } apps/engine.c:78: error: BUFFER_OVERRUN_S2 Offset: [1+max(1, `(*buf)->strlen`), `(*buf)->strlen` + 1] Size: [1, 256⋅`s->strlen` + 256⋅`(*buf)->strlen` + 66048]. Showing all 6 steps of the trace apps/engine.c:49:1: <Length trace> 47. }; 48. 49. > static int append_buf(char **buf, int *size, const char *s) 50. { 51. const int expand = 256; apps/engine.c:49:1: Parameter `**buf` 47. }; 48. 49. > static int append_buf(char **buf, int *size, const char *s) 50. { 51. const int expand = 256; apps/engine.c:53:5: Assignment 51. const int expand = 256; 52. int len = strlen(s) + 1; 53. char *p = *buf; ^ 54. 55. if (p == NULL) { apps/engine.c:76:13: Assignment 74. 75. if (blen > 0) { 76. p += blen; ^ 77. *p++ = ','; 78. *p++ = ' '; apps/engine.c:77:14: Assignment 75. if (blen > 0) { 76. p += blen; 77. *p++ = ','; ^ 78. *p++ = ' '; 79. } apps/engine.c:78:13: Array access: Offset: [1+max(1, (*buf)->strlen), (*buf)->strlen + 1] Size: [1, 256⋅s->strlen + 256⋅(*buf)->strlen + 66048] 76. p += blen; 77. *p++ = ','; 78. *p++ = ' '; ^ 79. } 80. }
https://github.com/openssl/openssl/blob/de2f409ef9de775df6db2c7de69b7bb0df21e380/apps/engine.c/#L78
d2a_code_trace_data_42787
static void init_dequant8_coeff_table(H264Context *h){ int i,q,x; const int transpose = (h->s.dsp.h264_idct8_add != ff_h264_idct8_add_c); h->dequant8_coeff[0] = h->dequant8_buffer[0]; h->dequant8_coeff[1] = h->dequant8_buffer[1]; for(i=0; i<2; i++ ){ if(i && !memcmp(h->pps.scaling_matrix8[0], h->pps.scaling_matrix8[1], 64*sizeof(uint8_t))){ h->dequant8_coeff[1] = h->dequant8_buffer[0]; break; } for(q=0; q<52; q++){ int shift = ff_div6[q]; int idx = ff_rem6[q]; for(x=0; x<64; x++) h->dequant8_coeff[i][q][transpose ? (x>>3)|((x&7)<<3) : x] = ((uint32_t)dequant8_coeff_init[idx][ dequant8_coeff_init_scan[((x>>1)&12) | (x&3)] ] * h->pps.scaling_matrix8[i][x]) << shift; } } } libavcodec/h264.c:2041: error: Buffer Overrun L2 Offset: [0, 52] (⇐ [0, 1] + [0, 51]) Size: 2. libavcodec/h264.c:2037:13: <Offset trace> 2035. } 2036. 2037. for(q=0; q<52; q++){ ^ 2038. int shift = ff_div6[q]; 2039. int idx = ff_rem6[q]; libavcodec/h264.c:2037:13: Assignment 2035. } 2036. 2037. for(q=0; q<52; q++){ ^ 2038. int shift = ff_div6[q]; 2039. int idx = ff_rem6[q]; libavcodec/h264.c:2025:1: <Length trace> 2023. } 2024. 2025. static void init_dequant8_coeff_table(H264Context *h){ ^ 2026. int i,q,x; 2027. const int transpose = (h->s.dsp.h264_idct8_add != ff_h264_idct8_add_c); //FIXME ugly libavcodec/h264.c:2025:1: Parameter `*h->dequant8_coeff[*]` 2023. } 2024. 2025. static void init_dequant8_coeff_table(H264Context *h){ ^ 2026. int i,q,x; 2027. const int transpose = (h->s.dsp.h264_idct8_add != ff_h264_idct8_add_c); //FIXME ugly libavcodec/h264.c:2041:17: Array access: Offset: [0, 52] (⇐ [0, 1] + [0, 51]) Size: 2 2039. int idx = ff_rem6[q]; 2040. for(x=0; x<64; x++) 2041. h->dequant8_coeff[i][q][transpose ? (x>>3)|((x&7)<<3) : x] = ^ 2042. ((uint32_t)dequant8_coeff_init[idx][ dequant8_coeff_init_scan[((x>>1)&12) | (x&3)] ] * 2043. h->pps.scaling_matrix8[i][x]) << shift;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L2041
d2a_code_trace_data_42788
void RAND_seed(const void *buf, int num) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->seed != NULL) meth->seed(buf, num); } crypto/rand/rand_lib.c:793: error: NULL_DEREFERENCE pointer `meth` last assigned on line 791 could be null and is dereferenced at line 793, column 9. Showing all 14 steps of the trace crypto/rand/rand_lib.c:789:1: start of procedure RAND_seed() 787. #endif 788. 789. > void RAND_seed(const void *buf, int num) 790. { 791. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:791:5: 789. void RAND_seed(const void *buf, int num) 790. { 791. > const RAND_METHOD *meth = RAND_get_rand_method(); 792. 793. if (meth->seed != NULL) crypto/rand/rand_lib.c:733:1: start of procedure RAND_get_rand_method() 731. } 732. 733. > const RAND_METHOD *RAND_get_rand_method(void) 734. { 735. const RAND_METHOD *tmp_meth = NULL; crypto/rand/rand_lib.c:735:5: 733. const RAND_METHOD *RAND_get_rand_method(void) 734. { 735. > const RAND_METHOD *tmp_meth = NULL; 736. 737. if (!RUN_ONCE(&rand_init, do_rand_init)) crypto/rand/rand_lib.c:737:10: 735. const RAND_METHOD *tmp_meth = NULL; 736. 737. > if (!RUN_ONCE(&rand_init, do_rand_init)) 738. return NULL; 739. 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:737:10: Condition is false 735. const RAND_METHOD *tmp_meth = NULL; 736. 737. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 738. return NULL; 739. crypto/rand/rand_lib.c:737:10: Taking true branch 735. const RAND_METHOD *tmp_meth = NULL; 736. 737. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 738. return NULL; 739. crypto/rand/rand_lib.c:738:9: 736. 737. if (!RUN_ONCE(&rand_init, do_rand_init)) 738. > return NULL; 739. 740. CRYPTO_THREAD_write_lock(rand_meth_lock); crypto/rand/rand_lib.c:761:1: return from a call to RAND_get_rand_method 759. CRYPTO_THREAD_unlock(rand_meth_lock); 760. return tmp_meth; 761. > } 762. 763. #ifndef OPENSSL_NO_ENGINE crypto/rand/rand_lib.c:793:9: 791. const RAND_METHOD *meth = RAND_get_rand_method(); 792. 793. > if (meth->seed != NULL) 794. meth->seed(buf, num); 795. }
https://github.com/openssl/openssl/blob/1901516a4ba909fff12e0e7815aa2d499f4d6d67/crypto/rand/rand_lib.c/#L793
d2a_code_trace_data_42789
static av_always_inline int epzs_motion_search_internal(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, int flags, int size, int h) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d; int dmin; int map_generation; int penalty_factor; 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 LOAD_COMMON2 if(c->pre_pass){ penalty_factor= c->pre_penalty_factor; cmpf= s->dsp.me_pre_cmp[size]; chroma_cmpf= s->dsp.me_pre_cmp[size+1]; }else{ penalty_factor= c->penalty_factor; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; } map_generation= update_map_generation(c); assert(cmpf); dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags); map[0]= map_generation; score_map[0]= dmin; if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0) dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor; 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) }else{ if(dmin<((h*h*s->avctx->mv0_threshold)>>8) && ( P_LEFT[0] |P_LEFT[1] |P_TOP[0] |P_TOP[1] |P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){ *mx_ptr= 0; *my_ptr= 0; c->skip=1; return dmin; } CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[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_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) } if(dmin>h*h*4){ if(c->pre_pass){ 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->first_slice_line) 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) }else{ 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) } } if(c->avctx->last_predictor_count){ const int count= c->avctx->last_predictor_count; const int xstart= FFMAX(0, s->mb_x - count); const int ystart= FFMAX(0, s->mb_y - count); const int xend= FFMIN(s->mb_width , s->mb_x + count + 1); const int yend= FFMIN(s->mb_height, s->mb_y + count + 1); int mb_y; for(mb_y=ystart; mb_y<yend; mb_y++){ int mb_x; for(mb_x=xstart; mb_x<xend; mb_x++){ const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride; int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16; int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16; if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; CHECK_MV(mx,my) } } } 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:1064: error: Uninitialized Value The value read from xmax was never initialized. libavcodec/motion_est_template.c:1064:9: 1062. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) 1063. CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift) 1064. CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) ^ 1065. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) 1066. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1064
d2a_code_trace_data_42790
static void alac_linear_predictor(AlacEncodeContext *s, int ch) { int i; AlacLPCContext lpc = s->lpc[ch]; if (lpc.lpc_order == 31) { s->predictor_buf[0] = s->sample_buf[ch][0]; for (i = 1; i < s->frame_size; i++) { s->predictor_buf[i] = s->sample_buf[ch][i ] - s->sample_buf[ch][i - 1]; } return; } if (lpc.lpc_order > 0) { int32_t *samples = s->sample_buf[ch]; int32_t *residual = s->predictor_buf; residual[0] = samples[0]; for (i = 1; i <= lpc.lpc_order; i++) residual[i] = samples[i] - samples[i-1]; for (i = lpc.lpc_order + 1; i < s->frame_size; i++) { int sum = 1 << (lpc.lpc_quant - 1), res_val, j; for (j = 0; j < lpc.lpc_order; j++) { sum += (samples[lpc.lpc_order-j] - samples[0]) * lpc.lpc_coeff[j]; } sum >>= lpc.lpc_quant; sum += samples[0]; residual[i] = sign_extend(samples[lpc.lpc_order+1] - sum, s->write_sample_size); res_val = residual[i]; if (res_val) { int index = lpc.lpc_order - 1; int neg = (res_val < 0); while (index >= 0 && (neg ? (res_val < 0) : (res_val > 0))) { int val = samples[0] - samples[lpc.lpc_order - index]; int sign = (val ? FFSIGN(val) : 0); if (neg) sign *= -1; lpc.lpc_coeff[index] -= sign; val *= sign; res_val -= (val >> lpc.lpc_quant) * (lpc.lpc_order - index); index--; } } samples++; } } } libavcodec/alacenc.c:431: error: Buffer Overrun L1 Offset: [2, +oo] (⇐ [0, +oo] + [2, +oo]) Size: 2 by call to `alac_linear_predictor`. libavcodec/alacenc.c:405:14: Assignment 403. put_bits(pb, 8, s->interlacing_leftweight); 404. 405. for (i = 0; i < channels; i++) { ^ 406. calc_predictor_params(s, i); 407. libavcodec/alacenc.c:431:13: Call 429. // apply lpc and entropy coding to audio samples 430. for (i = 0; i < channels; i++) { 431. alac_linear_predictor(s, i); ^ 432. 433. // TODO: determine when this will actually help. for now it's not used. libavcodec/alacenc.c:277:14: <Offset trace> 275. // generate warm-up samples 276. residual[0] = samples[0]; 277. for (i = 1; i <= lpc.lpc_order; i++) ^ 278. residual[i] = samples[i] - samples[i-1]; 279. libavcodec/alacenc.c:277:14: Assignment 275. // generate warm-up samples 276. residual[0] = samples[0]; 277. for (i = 1; i <= lpc.lpc_order; i++) ^ 278. residual[i] = samples[i] - samples[i-1]; 279. libavcodec/alacenc.c:253:1: <Length trace> 251. } 252. 253. static void alac_linear_predictor(AlacEncodeContext *s, int ch) ^ 254. { 255. int i; libavcodec/alacenc.c:253:1: Parameter `ch` 251. } 252. 253. static void alac_linear_predictor(AlacEncodeContext *s, int ch) ^ 254. { 255. int i; libavcodec/alacenc.c:272:9: Assignment 270. 271. if (lpc.lpc_order > 0) { 272. int32_t *samples = s->sample_buf[ch]; ^ 273. int32_t *residual = s->predictor_buf; 274. libavcodec/alacenc.c:291:39: Array access: Offset: [2, +oo] (⇐ [0, +oo] + [2, +oo]) Size: 2 by call to `alac_linear_predictor` 289. sum >>= lpc.lpc_quant; 290. sum += samples[0]; 291. residual[i] = sign_extend(samples[lpc.lpc_order+1] - sum, ^ 292. s->write_sample_size); 293. res_val = residual[i];
https://github.com/libav/libav/blob/a8cb1746c5b6307b2e820f965a7da8d907893b38/libavcodec/alacenc.c/#L291
d2a_code_trace_data_42791
static int gxf_write_mpeg_auxiliary(ByteIOContext *pb, GXFStreamContext *ctx) { char buffer[1024]; int size; if (ctx->iframes) { ctx->p_per_gop = ctx->pframes / ctx->iframes; if (ctx->pframes % ctx->iframes) ctx->p_per_gop++; if (ctx->pframes) ctx->b_per_gop = ctx->bframes / ctx->pframes; if (ctx->p_per_gop > 9) ctx->p_per_gop = 9; if (ctx->b_per_gop > 9) ctx->b_per_gop = 9; } size = snprintf(buffer, 1024, "Ver 1\nBr %.6f\nIpg 1\nPpi %d\nBpiop %d\n" "Pix 0\nCf %d\nCg %d\nSl 7\nnl16 %d\nVi 1\nf1 1\n", (float)ctx->codec->bit_rate, ctx->p_per_gop, ctx->b_per_gop, ctx->codec->pix_fmt == PIX_FMT_YUV422P ? 2 : 1, ctx->first_gop_closed == 1, ctx->codec->height / 16); put_byte(pb, TRACK_MPG_AUX); put_byte(pb, size + 1); put_buffer(pb, (uint8_t *)buffer, size + 1); return size + 3; } libavformat/gxfenc.c:193: error: Integer Overflow R2 ([0, +oo] + 3):signed32. libavformat/gxfenc.c:185:12: <LHS trace> 183. ctx->b_per_gop = 9; /* ensure value won't take more than one char */ 184. } 185. size = snprintf(buffer, 1024, "Ver 1\nBr %.6f\nIpg 1\nPpi %d\nBpiop %d\n" ^ 186. "Pix 0\nCf %d\nCg %d\nSl 7\nnl16 %d\nVi 1\nf1 1\n", 187. (float)ctx->codec->bit_rate, ctx->p_per_gop, ctx->b_per_gop, libavformat/gxfenc.c:185:12: Risky value from: snprintf 183. ctx->b_per_gop = 9; /* ensure value won't take more than one char */ 184. } 185. size = snprintf(buffer, 1024, "Ver 1\nBr %.6f\nIpg 1\nPpi %d\nBpiop %d\n" ^ 186. "Pix 0\nCf %d\nCg %d\nSl 7\nnl16 %d\nVi 1\nf1 1\n", 187. (float)ctx->codec->bit_rate, ctx->p_per_gop, ctx->b_per_gop, libavformat/gxfenc.c:185:5: Assignment 183. ctx->b_per_gop = 9; /* ensure value won't take more than one char */ 184. } 185. size = snprintf(buffer, 1024, "Ver 1\nBr %.6f\nIpg 1\nPpi %d\nBpiop %d\n" ^ 186. "Pix 0\nCf %d\nCg %d\nSl 7\nnl16 %d\nVi 1\nf1 1\n", 187. (float)ctx->codec->bit_rate, ctx->p_per_gop, ctx->b_per_gop, libavformat/gxfenc.c:193:5: Binary operation: ([0, +oo] + 3):signed32 191. put_byte(pb, size + 1); 192. put_buffer(pb, (uint8_t *)buffer, size + 1); 193. return size + 3; ^ 194. } 195.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/gxfenc.c/#L193
d2a_code_trace_data_42792
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/sm2/sm2_sign.c:237: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_add`. Showing all 17 steps of the trace crypto/sm2/sm2_sign.c:206:5: Call 204. } 205. 206. BN_CTX_start(ctx); ^ 207. k = BN_CTX_get(ctx); 208. rk = 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/sm2/sm2_sign.c:237:21: Call 235. || !EC_POINT_get_affine_coordinates(group, kG, x1, NULL, 236. ctx) 237. || !BN_mod_add(r, e, x1, order, ctx)) { ^ 238. SM2err(SM2_F_SM2_SIG_GEN, ERR_R_INTERNAL_ERROR); 239. goto done; crypto/bn/bn_mod.c:28:1: Parameter `ctx->stack.depth` 26. } 27. 28. > int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 29. BN_CTX *ctx) 30. { crypto/bn/bn_mod.c:33:12: Call 31. if (!BN_add(r, a, b)) 32. return 0; 33. return BN_nnmod(r, r, m, ctx); ^ 34. } 35. crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:190:5: Call 188. } 189. 190. BN_CTX_start(ctx); ^ 191. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 192. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:411:5: Call 409. if (no_branch) 410. bn_correct_top(res); 411. BN_CTX_end(ctx); ^ 412. return 1; 413. err: 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_mod_add` 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/571286b0a463b02ef2f9040a7e5d602635854832/crypto/bn/bn_ctx.c/#L276
d2a_code_trace_data_42793
static int newpass_p12(PKCS12 *p12, char *oldpass, char *newpass) { STACK *asafes, *newsafes, *bags; int i, bagnid, pbe_nid, pbe_iter, pbe_saltlen; PKCS7 *p7, *p7new; ASN1_OCTET_STRING *p12_data_tmp = NULL, *macnew = NULL; unsigned char mac[EVP_MAX_MD_SIZE]; unsigned int maclen; if (!(asafes = M_PKCS12_unpack_authsafes(p12))) return 0; if(!(newsafes = sk_new(NULL))) return 0; for (i = 0; i < sk_num (asafes); i++) { p7 = (PKCS7 *) sk_value(asafes, i); bagnid = OBJ_obj2nid(p7->type); if (bagnid == NID_pkcs7_data) { bags = M_PKCS12_unpack_p7data(p7); } else if (bagnid == NID_pkcs7_encrypted) { bags = M_PKCS12_unpack_p7encdata(p7, oldpass, -1); alg_get(p7->d.encrypted->enc_data->algorithm, &pbe_nid, &pbe_iter, &pbe_saltlen); } else continue; if (!bags) { sk_pop_free(asafes, (void(*)(void *)) PKCS7_free); return 0; } if (!newpass_bags(bags, oldpass, newpass)) { sk_pop_free(bags, (void(*)(void *)) PKCS12_SAFEBAG_free); sk_pop_free(asafes, (void(*)(void *)) PKCS7_free); return 0; } if (bagnid == NID_pkcs7_data) p7new = PKCS12_pack_p7data(bags); else p7new = PKCS12_pack_p7encdata(pbe_nid, newpass, -1, NULL, pbe_saltlen, pbe_iter, bags); sk_pop_free(bags, (void(*)(void *)) PKCS12_SAFEBAG_free); if(!p7new) { sk_pop_free(asafes, (void(*)(void *)) PKCS7_free); return 0; } sk_push(newsafes, (char *)p7new); } sk_pop_free(asafes, (void(*)(void *)) PKCS7_free); p12_data_tmp = p12->authsafes->d.data; if(!(p12->authsafes->d.data = ASN1_OCTET_STRING_new())) goto saferr; if(!M_PKCS12_pack_authsafes(p12, newsafes)) goto saferr; if(!PKCS12_gen_mac(p12, newpass, -1, mac, &maclen)) goto saferr; if(!(macnew = ASN1_OCTET_STRING_new())) goto saferr; if(!ASN1_OCTET_STRING_set(macnew, mac, maclen)) goto saferr; ASN1_OCTET_STRING_free(p12->mac->dinfo->digest); p12->mac->dinfo->digest = macnew; ASN1_OCTET_STRING_free(p12_data_tmp); return 1; saferr: ASN1_OCTET_STRING_free(p12->authsafes->d.data); ASN1_OCTET_STRING_free(macnew); p12->authsafes->d.data = p12_data_tmp; return 0; } crypto/pkcs12/p12_npas.c:136: error: UNINITIALIZED_VALUE The value read from pbe_nid was never initialized. Showing all 1 steps of the trace crypto/pkcs12/p12_npas.c:136:16: 134. /* Repack bag in same form with new password */ 135. if (bagnid == NID_pkcs7_data) p7new = PKCS12_pack_p7data(bags); 136. > else p7new = PKCS12_pack_p7encdata(pbe_nid, newpass, -1, NULL, 137. pbe_saltlen, pbe_iter, bags); 138. sk_pop_free(bags, (void(*)(void *)) PKCS12_SAFEBAG_free);
https://github.com/openssl/openssl/blob/0e1c06128adbfd2d88dc304db2262140bad045fd/crypto/pkcs12/p12_npas.c/#L136
d2a_code_trace_data_42794
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return 0; r->neg = a->neg; lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return 1; } test/sslapitest.c:3897: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN`. Showing all 22 steps of the trace test/sslapitest.c:3897:10: Call 3895. goto end; 3896. 3897. if (!TEST_true(SRP_create_verifier_BN(userid, password, &salt, &verifier, ^ 3898. lgN->N, lgN->g))) 3899. goto end; crypto/srp/srp_vfy.c:662:1: Parameter `g->top` 660. * BIGNUMS. 661. */ 662. > int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, 663. BIGNUM **verifier, const BIGNUM *N, 664. const BIGNUM *g) crypto/srp/srp_vfy.c:693:10: Call 691. goto err; 692. 693. if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) { ^ 694. BN_clear_free(*verifier); 695. goto err; crypto/bn/bn_exp.c:89:1: Parameter `a->top` 87. } 88. 89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 90. BN_CTX *ctx) 91. { crypto/bn/bn_exp.c:144:19: Call 142. } else 143. # endif 144. ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL); ^ 145. } else 146. #endif crypto/bn/bn_exp.c:296:1: Parameter `a->top` 294. } 295. 296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 298. { crypto/bn/bn_exp.c:310:16: Call 308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { 310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 311. } 312. crypto/bn/bn_exp.c:598:1: Parameter `a->top` 596. * http://www.daemonology.net/hyperthreading-considered-harmful/) 597. */ 598. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 599. const BIGNUM *m, BN_CTX *ctx, 600. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:757:14: Call 755. /* prepare a^1 in Montgomery domain */ 756. if (a->neg || BN_ucmp(a, m) >= 0) { 757. if (!BN_nnmod(&am, a, m, ctx)) ^ 758. goto err; 759. if (!BN_to_montgomery(&am, &am, mont, ctx)) crypto/bn/bn_mod.c:13:1: Parameter `m->top` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:137:1: Parameter `num->top` 135. * If 'dv' or 'rm' is NULL, the respective value is not returned. 136. */ 137. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 138. BN_CTX *ctx) 139. { crypto/bn/bn_div.c:204:11: Call 202. sdiv->neg = 0; 203. norm_shift += BN_BITS2; 204. if (!(BN_lshift(snum, num, norm_shift))) ^ 205. goto err; 206. snum->neg = 0; crypto/bn/bn_shift.c:83:1: <Offset trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `n` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:5: Assignment 95. } 96. 97. nw = n / BN_BITS2; ^ 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) 99. return 0; crypto/bn/bn_shift.c:83:1: <Length trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `*r->d` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:98:9: Call 96. 97. nw = n / BN_BITS2; 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 99. return 0; 100. r->neg = a->neg; crypto/bn/bn_lib.c:910:1: Parameter `*a->d` 908. } 909. 910. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 911. { 912. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:104:5: Assignment 102. rb = BN_BITS2 - lb; 103. f = a->d; 104. t = r->d; ^ 105. t[a->top + nw] = 0; 106. if (lb == 0) crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN` 110. for (i = a->top - 1; i >= 0; i--) { 111. l = f[i]; 112. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 113. t[nw + i] = (l << lb) & BN_MASK2; 114. }
https://github.com/openssl/openssl/blob/a8ca496ddb532d7f7dc356fd2b026697388d2384/crypto/bn/bn_shift.c/#L112
d2a_code_trace_data_42795
PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx) { STACK_OF(PKCS7_RECIP_INFO) *rsk; PKCS7_RECIP_INFO *ri; int i; i=OBJ_obj2nid(p7->type); if (i != NID_pkcs7_signedAndEnveloped) return(NULL); rsk=p7->d.signed_and_enveloped->recipientinfo; ri=sk_PKCS7_RECIP_INFO_value(rsk,0); if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL); ri=sk_PKCS7_RECIP_INFO_value(rsk,idx); return(ri->issuer_and_serial); } crypto/pkcs7/pk7_doit.c:796: error: NULL_DEREFERENCE pointer `ri` last assigned on line 795 could be null and is dereferenced at line 796, column 8. Showing all 39 steps of the trace crypto/pkcs7/pk7_doit.c:784:1: start of procedure PKCS7_get_issuer_and_serial() 782. } 783. 784. > PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx) 785. { 786. STACK_OF(PKCS7_RECIP_INFO) *rsk; crypto/pkcs7/pk7_doit.c:790:2: 788. int i; 789. 790. > i=OBJ_obj2nid(p7->type); 791. if (i != NID_pkcs7_signedAndEnveloped) return(NULL); 792. rsk=p7->d.signed_and_enveloped->recipientinfo; crypto/objects/obj_dat.c:363:1: start of procedure OBJ_obj2nid() 361. } 362. 363. > int OBJ_obj2nid(const ASN1_OBJECT *a) 364. { 365. ASN1_OBJECT **op; crypto/objects/obj_dat.c:368:6: Taking false branch 366. ADDED_OBJ ad,*adp; 367. 368. if (a == NULL) ^ 369. return(NID_undef); 370. if (a->nid != 0) crypto/objects/obj_dat.c:370:6: Taking false branch 368. if (a == NULL) 369. return(NID_undef); 370. if (a->nid != 0) ^ 371. return(a->nid); 372. crypto/objects/obj_dat.c:373:6: Taking true branch 371. return(a->nid); 372. 373. if (added != NULL) ^ 374. { 375. ad.type=ADDED_DATA; crypto/objects/obj_dat.c:375:3: 373. if (added != NULL) 374. { 375. > ad.type=ADDED_DATA; 376. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 377. adp=(ADDED_OBJ *)lh_retrieve(added,&ad); crypto/objects/obj_dat.c:376:3: 374. { 375. ad.type=ADDED_DATA; 376. > ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 377. adp=(ADDED_OBJ *)lh_retrieve(added,&ad); 378. if (adp != NULL) return (adp->obj->nid); crypto/objects/obj_dat.c:377:3: 375. ad.type=ADDED_DATA; 376. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 377. > adp=(ADDED_OBJ *)lh_retrieve(added,&ad); 378. if (adp != NULL) return (adp->obj->nid); 379. } crypto/lhash/lhash.c:248:1: start of procedure lh_retrieve() 246. } 247. 248. > void *lh_retrieve(LHASH *lh, const void *data) 249. { 250. unsigned long hash; crypto/lhash/lhash.c:254:2: 252. const void *ret; 253. 254. > lh->error=0; 255. rn=getrn(lh,data,&hash); 256. crypto/lhash/lhash.c:255:2: Skipping getrn(): empty list of specs 253. 254. lh->error=0; 255. rn=getrn(lh,data,&hash); ^ 256. 257. if (*rn == NULL) crypto/lhash/lhash.c:257:6: Taking false branch 255. rn=getrn(lh,data,&hash); 256. 257. if (*rn == NULL) ^ 258. { 259. lh->num_retrieve_miss++; crypto/lhash/lhash.c:264:3: 262. else 263. { 264. > ret= (*rn)->data; 265. lh->num_retrieve++; 266. } crypto/lhash/lhash.c:265:3: 263. { 264. ret= (*rn)->data; 265. > lh->num_retrieve++; 266. } 267. return((void *)ret); crypto/lhash/lhash.c:267:2: 265. lh->num_retrieve++; 266. } 267. > return((void *)ret); 268. } 269. crypto/lhash/lhash.c:268:2: return from a call to lh_retrieve 266. } 267. return((void *)ret); 268. } ^ 269. 270. void lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func) crypto/objects/obj_dat.c:378:7: Taking true branch 376. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 377. adp=(ADDED_OBJ *)lh_retrieve(added,&ad); 378. if (adp != NULL) return (adp->obj->nid); ^ 379. } 380. op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ, crypto/objects/obj_dat.c:378:20: 376. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 377. adp=(ADDED_OBJ *)lh_retrieve(added,&ad); 378. > if (adp != NULL) return (adp->obj->nid); 379. } 380. op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ, crypto/objects/obj_dat.c:385:2: return from a call to OBJ_obj2nid 383. return(NID_undef); 384. return((*op)->nid); 385. } ^ 386. 387. /* Convert an object name into an ASN1_OBJECT crypto/pkcs7/pk7_doit.c:791:6: Taking false branch 789. 790. i=OBJ_obj2nid(p7->type); 791. if (i != NID_pkcs7_signedAndEnveloped) return(NULL); ^ 792. rsk=p7->d.signed_and_enveloped->recipientinfo; 793. ri=sk_PKCS7_RECIP_INFO_value(rsk,0); crypto/pkcs7/pk7_doit.c:792:2: 790. i=OBJ_obj2nid(p7->type); 791. if (i != NID_pkcs7_signedAndEnveloped) return(NULL); 792. > rsk=p7->d.signed_and_enveloped->recipientinfo; 793. ri=sk_PKCS7_RECIP_INFO_value(rsk,0); 794. if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL); crypto/pkcs7/pk7_doit.c:793:2: 791. if (i != NID_pkcs7_signedAndEnveloped) return(NULL); 792. rsk=p7->d.signed_and_enveloped->recipientinfo; 793. > ri=sk_PKCS7_RECIP_INFO_value(rsk,0); 794. if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL); 795. ri=sk_PKCS7_RECIP_INFO_value(rsk,idx); crypto/stack/stack.c:305:1: start of procedure sk_value() 303. } 304. 305. > char *sk_value(const STACK *st, int i) 306. { 307. if(st == NULL) return NULL; crypto/stack/stack.c:307:5: Taking true branch 305. char *sk_value(const STACK *st, int i) 306. { 307. if(st == NULL) return NULL; ^ 308. return st->data[i]; 309. } crypto/stack/stack.c:307:17: 305. char *sk_value(const STACK *st, int i) 306. { 307. > if(st == NULL) return NULL; 308. return st->data[i]; 309. } crypto/stack/stack.c:309:1: return from a call to sk_value 307. if(st == NULL) return NULL; 308. return st->data[i]; 309. > } 310. 311. char *sk_set(STACK *st, int i, char *value) crypto/pkcs7/pk7_doit.c:794:6: 792. rsk=p7->d.signed_and_enveloped->recipientinfo; 793. ri=sk_PKCS7_RECIP_INFO_value(rsk,0); 794. > if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL); 795. ri=sk_PKCS7_RECIP_INFO_value(rsk,idx); 796. return(ri->issuer_and_serial); crypto/stack/stack.c:299:1: start of procedure sk_num() 297. } 298. 299. > int sk_num(const STACK *st) 300. { 301. if(st == NULL) return -1; crypto/stack/stack.c:301:5: Taking true branch 299. int sk_num(const STACK *st) 300. { 301. if(st == NULL) return -1; ^ 302. return st->num; 303. } crypto/stack/stack.c:301:17: 299. int sk_num(const STACK *st) 300. { 301. > if(st == NULL) return -1; 302. return st->num; 303. } crypto/stack/stack.c:303:1: return from a call to sk_num 301. if(st == NULL) return -1; 302. return st->num; 303. > } 304. 305. char *sk_value(const STACK *st, int i) crypto/pkcs7/pk7_doit.c:794:6: Taking false branch 792. rsk=p7->d.signed_and_enveloped->recipientinfo; 793. ri=sk_PKCS7_RECIP_INFO_value(rsk,0); 794. if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL); ^ 795. ri=sk_PKCS7_RECIP_INFO_value(rsk,idx); 796. return(ri->issuer_and_serial); crypto/pkcs7/pk7_doit.c:795:2: 793. ri=sk_PKCS7_RECIP_INFO_value(rsk,0); 794. if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL); 795. > ri=sk_PKCS7_RECIP_INFO_value(rsk,idx); 796. return(ri->issuer_and_serial); 797. } crypto/stack/stack.c:305:1: start of procedure sk_value() 303. } 304. 305. > char *sk_value(const STACK *st, int i) 306. { 307. if(st == NULL) return NULL; crypto/stack/stack.c:307:5: Taking true branch 305. char *sk_value(const STACK *st, int i) 306. { 307. if(st == NULL) return NULL; ^ 308. return st->data[i]; 309. } crypto/stack/stack.c:307:17: 305. char *sk_value(const STACK *st, int i) 306. { 307. > if(st == NULL) return NULL; 308. return st->data[i]; 309. } crypto/stack/stack.c:309:1: return from a call to sk_value 307. if(st == NULL) return NULL; 308. return st->data[i]; 309. > } 310. 311. char *sk_set(STACK *st, int i, char *value) crypto/pkcs7/pk7_doit.c:796:2: 794. if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL); 795. ri=sk_PKCS7_RECIP_INFO_value(rsk,idx); 796. > return(ri->issuer_and_serial); 797. } 798.
https://github.com/openssl/openssl/blob/ec5add8784a2ffacd3391daae7937e04225da9da/crypto/pkcs7/pk7_doit.c/#L796
d2a_code_trace_data_42796
static int do_multi(int multi) { int n; int fd[2]; int *fds; static char sep[] = ":"; fds = malloc(sizeof(*fds) * multi); for (n = 0; n < multi; ++n) { if (pipe(fd) == -1) { BIO_printf(bio_err, "pipe failure\n"); exit(1); } fflush(stdout); (void)BIO_flush(bio_err); if (fork()) { close(fd[1]); fds[n] = fd[0]; } else { close(fd[0]); close(1); if (dup(fd[1]) == -1) { BIO_printf(bio_err, "dup failed\n"); exit(1); } close(fd[1]); mr = 1; usertime = 0; free(fds); return 0; } printf("Forked child %d\n", n); } for (n = 0; n < multi; ++n) { FILE *f; char buf[1024]; char *p; f = fdopen(fds[n], "r"); while (fgets(buf, sizeof buf, f)) { p = strchr(buf, '\n'); if (p) *p = '\0'; if (buf[0] != '+') { BIO_printf(bio_err, "Don't understand line '%s' from child %d\n", buf, n); continue; } printf("Got: %s from %d\n", buf, n); if (strncmp(buf, "+F:", 3) == 0) { int alg; int j; p = buf + 3; alg = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); for (j = 0; j < SIZE_NUM; ++j) results[alg][j] += atof(sstrsep(&p, sep)); } else if (strncmp(buf, "+F2:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); if (n) rsa_results[k][0] = 1 / (1 / rsa_results[k][0] + 1 / d); else rsa_results[k][0] = d; d = atof(sstrsep(&p, sep)); if (n) rsa_results[k][1] = 1 / (1 / rsa_results[k][1] + 1 / d); else rsa_results[k][1] = d; } # ifndef OPENSSL_NO_DSA else if (strncmp(buf, "+F3:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); if (n) dsa_results[k][0] = 1 / (1 / dsa_results[k][0] + 1 / d); else dsa_results[k][0] = d; d = atof(sstrsep(&p, sep)); if (n) dsa_results[k][1] = 1 / (1 / dsa_results[k][1] + 1 / d); else dsa_results[k][1] = d; } # endif # ifndef OPENSSL_NO_EC else if (strncmp(buf, "+F4:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); if (n) ecdsa_results[k][0] = 1 / (1 / ecdsa_results[k][0] + 1 / d); else ecdsa_results[k][0] = d; d = atof(sstrsep(&p, sep)); if (n) ecdsa_results[k][1] = 1 / (1 / ecdsa_results[k][1] + 1 / d); else ecdsa_results[k][1] = d; } # endif # ifndef OPENSSL_NO_EC else if (strncmp(buf, "+F5:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); if (n) ecdh_results[k][0] = 1 / (1 / ecdh_results[k][0] + 1 / d); else ecdh_results[k][0] = d; } # endif else if (strncmp(buf, "+H:", 3) == 0) { ; } else BIO_printf(bio_err, "Unknown type '%s' from child %d\n", buf, n); } fclose(f); } free(fds); return 1; } apps/speed.c:2943: error: NULL_DEREFERENCE pointer `fds` last assigned on line 2933 could be null and is dereferenced at line 2943, column 13. Showing all 19 steps of the trace apps/speed.c:2926:1: start of procedure do_multi() 2924. } 2925. 2926. > static int do_multi(int multi) 2927. { 2928. int n; apps/speed.c:2931:5: 2929. int fd[2]; 2930. int *fds; 2931. > static char sep[] = ":"; 2932. 2933. fds = malloc(sizeof(*fds) * multi); apps/speed.c:2933:5: 2931. static char sep[] = ":"; 2932. 2933. > fds = malloc(sizeof(*fds) * multi); 2934. for (n = 0; n < multi; ++n) { 2935. if (pipe(fd) == -1) { apps/speed.c:2934:10: 2932. 2933. fds = malloc(sizeof(*fds) * multi); 2934. > for (n = 0; n < multi; ++n) { 2935. if (pipe(fd) == -1) { 2936. BIO_printf(bio_err, "pipe failure\n"); apps/speed.c:2934:17: Loop condition is true. Entering loop body 2932. 2933. fds = malloc(sizeof(*fds) * multi); 2934. for (n = 0; n < multi; ++n) { ^ 2935. if (pipe(fd) == -1) { 2936. BIO_printf(bio_err, "pipe failure\n"); apps/speed.c:2935:13: Taking false branch 2933. fds = malloc(sizeof(*fds) * multi); 2934. for (n = 0; n < multi; ++n) { 2935. if (pipe(fd) == -1) { ^ 2936. BIO_printf(bio_err, "pipe failure\n"); 2937. exit(1); apps/speed.c:2939:9: 2937. exit(1); 2938. } 2939. > fflush(stdout); 2940. (void)BIO_flush(bio_err); 2941. if (fork()) { apps/speed.c:2940:15: 2938. } 2939. fflush(stdout); 2940. > (void)BIO_flush(bio_err); 2941. if (fork()) { 2942. close(fd[1]); crypto/bio/bio_lib.c:389:1: start of procedure BIO_ctrl() 387. } 388. 389. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg) 390. { 391. long ret; crypto/bio/bio_lib.c:394:9: Taking false branch 392. long (*cb) (BIO *, int, const char *, int, long, long); 393. 394. if (b == NULL) ^ 395. return (0); 396. crypto/bio/bio_lib.c:397:10: Taking false branch 395. return (0); 396. 397. if ((b->method == NULL) || (b->method->ctrl == NULL)) { ^ 398. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 399. return (-2); crypto/bio/bio_lib.c:397:33: Taking true branch 395. return (0); 396. 397. if ((b->method == NULL) || (b->method->ctrl == NULL)) { ^ 398. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 399. return (-2); crypto/bio/bio_lib.c:398:9: Skipping ERR_put_error(): empty list of specs 396. 397. if ((b->method == NULL) || (b->method->ctrl == NULL)) { 398. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); ^ 399. return (-2); 400. } crypto/bio/bio_lib.c:399:9: 397. if ((b->method == NULL) || (b->method->ctrl == NULL)) { 398. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 399. > return (-2); 400. } 401. crypto/bio/bio_lib.c:413:1: return from a call to BIO_ctrl 411. ret = cb(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, cmd, larg, ret); 412. return (ret); 413. > } 414. 415. long BIO_callback_ctrl(BIO *b, int cmd, apps/speed.c:2940:9: 2938. } 2939. fflush(stdout); 2940. > (void)BIO_flush(bio_err); 2941. if (fork()) { 2942. close(fd[1]); apps/speed.c:2941:13: Taking true branch 2939. fflush(stdout); 2940. (void)BIO_flush(bio_err); 2941. if (fork()) { ^ 2942. close(fd[1]); 2943. fds[n] = fd[0]; apps/speed.c:2942:13: 2940. (void)BIO_flush(bio_err); 2941. if (fork()) { 2942. > close(fd[1]); 2943. fds[n] = fd[0]; 2944. } else { apps/speed.c:2943:13: 2941. if (fork()) { 2942. close(fd[1]); 2943. > fds[n] = fd[0]; 2944. } else { 2945. close(fd[0]);
https://github.com/openssl/openssl/blob/5968d11a7a28103610c054c6a57c852bbe0f3b51/apps/speed.c/#L2943
d2a_code_trace_data_42797
static inline int get_context(FFV1Context *f, int_fast16_t *src, int_fast16_t *last, int_fast16_t *last2){ const int LT= last[-1]; const int T= last[ 0]; const int RT= last[ 1]; const int L = src[-1]; if(f->quant_table[3][127]){ const int TT= last2[0]; const int LL= src[-2]; return f->quant_table[0][(L-LT) & 0xFF] + f->quant_table[1][(LT-T) & 0xFF] + f->quant_table[2][(T-RT) & 0xFF] +f->quant_table[3][(LL-L) & 0xFF] + f->quant_table[4][(TT-T) & 0xFF]; }else return f->quant_table[0][(L-LT) & 0xFF] + f->quant_table[1][(LT-T) & 0xFF] + f->quant_table[2][(T-RT) & 0xFF]; } libavcodec/ffv1.c:787: error: Buffer Overrun L1 Offset: [3, `w` + 3] Size: 2 by call to `decode_line`. libavcodec/ffv1.c:768:1: Parameter `w` 766. } 767. 768. static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){ ^ 769. int x, y; 770. int_fast16_t sample_buffer[2][w+6]; libavcodec/ffv1.c:787:9: Call 785. 786. //{START_TIMER 787. decode_line(s, w, sample, plane_index, 8); ^ 788. for(x=0; x<w; x++){ 789. src[x + stride*y]= sample[1][x]; libavcodec/ffv1.c:711:1: Parameter `w` 709. } 710. 711. static inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ ^ 712. PlaneContext * const p= &s->plane[plane_index]; 713. RangeCoder * const c= &s->c; libavcodec/ffv1.c:722:18: Call 720. int diff, context, sign; 721. 722. context= get_context(s, sample[1] + x, sample[0] + x, sample[1] + x); ^ 723. if(context < 0){ 724. context= -context; libavcodec/ffv1.c:207:1: <Length trace> 205. } 206. 207. static inline int get_context(FFV1Context *f, int_fast16_t *src, int_fast16_t *last, int_fast16_t *last2){ ^ 208. const int LT= last[-1]; 209. const int T= last[ 0]; libavcodec/ffv1.c:207:1: Parameter `*last2` 205. } 206. 207. static inline int get_context(FFV1Context *f, int_fast16_t *src, int_fast16_t *last, int_fast16_t *last2){ ^ 208. const int LT= last[-1]; 209. const int T= last[ 0]; libavcodec/ffv1.c:214:23: Array access: Offset: [3, w + 3] Size: 2 by call to `decode_line` 212. 213. if(f->quant_table[3][127]){ 214. const int TT= last2[0]; ^ 215. const int LL= src[-2]; 216. return f->quant_table[0][(L-LT) & 0xFF] + f->quant_table[1][(LT-T) & 0xFF] + f->quant_table[2][(T-RT) & 0xFF]
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ffv1.c/#L214
d2a_code_trace_data_42798
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { if (!ossl_assert(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:895: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_put_bytes__`. Showing all 12 steps of the trace ssl/statem/extensions_srvr.c:894:13: Call 892. */ 893. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_max_fragment_length) 894. || !WPACKET_start_sub_packet_u16(pkt) ^ 895. || !WPACKET_put_bytes_u8(pkt, s->session->ext.max_fragment_len_mode) 896. || !WPACKET_close(pkt)) { ssl/packet.c:270:1: Parameter `pkt->buf->length` 268. } 269. 270. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 271. { 272. WPACKET_SUB *sub; ssl/statem/extensions_srvr.c:895:13: Call 893. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_max_fragment_length) 894. || !WPACKET_start_sub_packet_u16(pkt) 895. || !WPACKET_put_bytes_u8(pkt, s->session->ext.max_fragment_len_mode) ^ 896. || !WPACKET_close(pkt)) { 897. SSLerr(SSL_F_TLS_CONSTRUCT_STOC_MAXFRAGMENTLEN, ERR_R_INTERNAL_ERROR); ssl/packet.c:306:1: Parameter `pkt->written` 304. } 305. 306. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 307. { 308. unsigned char *data; ssl/packet.c:312:17: Call 310. /* Internal API, so should not fail */ 311. if (!ossl_assert(size <= sizeof(unsigned int)) 312. || !WPACKET_allocate_bytes(pkt, size, &data) ^ 313. || !put_value(data, val, size)) 314. 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:48:36: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 4]):unsigned64 by call to `WPACKET_put_bytes__` 46. return 0; 47. 48. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { ^ 49. size_t newlen; 50. size_t reflen;
https://github.com/openssl/openssl/blob/9f5671c7e9f30dfa53b1a2b553f234c2761ceb66/ssl/packet.c/#L48
d2a_code_trace_data_42799
int BIO_parse_hostserv(const char *hostserv, char **host, char **service, enum BIO_hostserv_priorities hostserv_prio) { const char *h = NULL; size_t hl = 0; const char *p = NULL; size_t pl = 0; if (*hostserv == '[') { if ((p = strchr(hostserv, ']')) == NULL) goto spec_err; h = hostserv + 1; hl = p - h; p++; if (*p == '\0') p = NULL; else if (*p != ':') goto spec_err; else { p++; pl = strlen(p); } } else { const char *p2 = strrchr(hostserv, ':'); p = strchr(hostserv, ':'); if (p != p2) goto amb_err; if (p != NULL) { h = hostserv; hl = p - h; p++; pl = strlen(p); } else if (hostserv_prio == BIO_PARSE_PRIO_HOST) { h = hostserv; hl = strlen(h); } else { p = hostserv; pl = strlen(p); } } if (strchr(p, ':')) goto spec_err; if (h != NULL && host != NULL) { if (hl == 0 || (hl == 1 && h[0] == '*')) { *host = NULL; } else { *host = OPENSSL_strndup(h, hl); if (*host == NULL) goto memerr; } } if (p != NULL && service != NULL) { if (pl == 0 || (pl == 1 && p[0] == '*')) { *service = NULL; } else { *service = OPENSSL_strndup(p, pl); if (*service == NULL) goto memerr; } } return 1; amb_err: BIOerr(BIO_F_BIO_PARSE_HOSTSERV, BIO_R_AMBIGUOUS_HOST_OR_SERVICE); return 0; spec_err: BIOerr(BIO_F_BIO_PARSE_HOSTSERV, BIO_R_MALFORMED_HOST_OR_SERVICE); return 0; memerr: BIOerr(BIO_F_BIO_PARSE_HOSTSERV, ERR_R_MALLOC_FAILURE); return 0; } crypto/bio/b_addr.c:501: error: NULL_DEREFERENCE pointer `p` last assigned on line 463 could be null and is dereferenced by call to `strchr()` at line 501, column 9. Showing all 13 steps of the trace crypto/bio/b_addr.c:450:1: start of procedure BIO_parse_hostserv() 448. * 449. */ 450. > int BIO_parse_hostserv(const char *hostserv, char **host, char **service, 451. enum BIO_hostserv_priorities hostserv_prio) 452. { crypto/bio/b_addr.c:453:5: 451. enum BIO_hostserv_priorities hostserv_prio) 452. { 453. > const char *h = NULL; size_t hl = 0; 454. const char *p = NULL; size_t pl = 0; 455. crypto/bio/b_addr.c:453:27: 451. enum BIO_hostserv_priorities hostserv_prio) 452. { 453. > const char *h = NULL; size_t hl = 0; 454. const char *p = NULL; size_t pl = 0; 455. crypto/bio/b_addr.c:454:5: 452. { 453. const char *h = NULL; size_t hl = 0; 454. > const char *p = NULL; size_t pl = 0; 455. 456. if (*hostserv == '[') { crypto/bio/b_addr.c:454:27: 452. { 453. const char *h = NULL; size_t hl = 0; 454. > const char *p = NULL; size_t pl = 0; 455. 456. if (*hostserv == '[') { crypto/bio/b_addr.c:456:9: Taking true branch 454. const char *p = NULL; size_t pl = 0; 455. 456. if (*hostserv == '[') { ^ 457. if ((p = strchr(hostserv, ']')) == NULL) 458. goto spec_err; crypto/bio/b_addr.c:457:13: Taking false branch 455. 456. if (*hostserv == '[') { 457. if ((p = strchr(hostserv, ']')) == NULL) ^ 458. goto spec_err; 459. h = hostserv + 1; crypto/bio/b_addr.c:459:9: 457. if ((p = strchr(hostserv, ']')) == NULL) 458. goto spec_err; 459. > h = hostserv + 1; 460. hl = p - h; 461. p++; crypto/bio/b_addr.c:460:9: 458. goto spec_err; 459. h = hostserv + 1; 460. > hl = p - h; 461. p++; 462. if (*p == '\0') crypto/bio/b_addr.c:461:9: 459. h = hostserv + 1; 460. hl = p - h; 461. > p++; 462. if (*p == '\0') 463. p = NULL; crypto/bio/b_addr.c:462:13: Taking true branch 460. hl = p - h; 461. p++; 462. if (*p == '\0') ^ 463. p = NULL; 464. else if (*p != ':') crypto/bio/b_addr.c:463:13: 461. p++; 462. if (*p == '\0') 463. > p = NULL; 464. else if (*p != ':') 465. goto spec_err; crypto/bio/b_addr.c:501:9: 499. } 500. 501. > if (strchr(p, ':')) 502. goto spec_err; 503.
https://github.com/openssl/openssl/blob/1cc98f75bfaf16a3a1038cf36cb053f330e4ac30/crypto/bio/b_addr.c/#L501
d2a_code_trace_data_42800
static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, BN_CTX *ctx) { unsigned char *buf = NULL; int b, ret = 0, bit, bytes, mask; OPENSSL_CTX *libctx = bn_get_lib_ctx(ctx); if (bits == 0) { if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) goto toosmall; BN_zero(rnd); return 1; } if (bits < 0 || (bits == 1 && top > 0)) goto toosmall; bytes = (bits + 7) / 8; bit = (bits - 1) % 8; mask = 0xff << (bit + 1); buf = OPENSSL_malloc(bytes); if (buf == NULL) { BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); goto err; } b = flag == NORMAL ? rand_bytes_ex(libctx, buf, bytes) : rand_priv_bytes_ex(libctx, buf, bytes); if (b <= 0) goto err; if (flag == TESTING) { int i; unsigned char c; for (i = 0; i < bytes; i++) { if (rand_bytes_ex(libctx, &c, 1) <= 0) goto err; if (c >= 128 && i > 0) buf[i] = buf[i - 1]; else if (c < 42) buf[i] = 0; else if (c < 84) buf[i] = 255; } } if (top >= 0) { if (top) { if (bit == 0) { buf[0] = 1; buf[1] |= 0x80; } else { buf[0] |= (3 << (bit - 1)); } } else { buf[0] |= (1 << bit); } } buf[0] &= ~mask; if (bottom) buf[bytes - 1] |= 1; if (!BN_bin2bn(buf, bytes, rnd)) goto err; ret = 1; err: OPENSSL_clear_free(buf, bytes); bn_check_top(rnd); return ret; toosmall: BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL); return 0; } test/bntest.c:616: error: BUFFER_OVERRUN_L3 Offset: [-1, 518] Size: [1, 519] by call to `BN_rand`. Showing all 12 steps of the trace test/bntest.c:616:15: Call 614. 615. for (i = 0; i < NUM0; i++) { 616. if (!(TEST_true(BN_rand(a, 512, 0, 0)) ^ 617. && TEST_ptr(BN_copy(b, BN_value_one())))) 618. goto err; crypto/bn/bn_rand.c:106:1: Parameter `bits` 104. return bnrand(NORMAL, rnd, bits, top, bottom, ctx); 105. } 106. > int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 107. { 108. return bnrand(NORMAL, rnd, bits, top, bottom, NULL); crypto/bn/bn_rand.c:108:12: Call 106. int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 107. { 108. return bnrand(NORMAL, rnd, bits, top, bottom, NULL); ^ 109. } 110. crypto/bn/bn_rand.c:62:14: <Offset trace> 60. unsigned char c; 61. 62. for (i = 0; i < bytes; i++) { ^ 63. if (rand_bytes_ex(libctx, &c, 1) <= 0) 64. goto err; crypto/bn/bn_rand.c:62:14: Assignment 60. unsigned char c; 61. 62. for (i = 0; i < bytes; i++) { ^ 63. if (rand_bytes_ex(libctx, &c, 1) <= 0) 64. goto err; crypto/bn/bn_rand.c:23:1: <Length trace> 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_rand.c:23:1: Parameter `bits` 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_rand.c:39:5: Assignment 37. goto toosmall; 38. 39. bytes = (bits + 7) / 8; ^ 40. bit = (bits - 1) % 8; 41. mask = 0xff << (bit + 1); crypto/bn/bn_rand.c:43:11: Call 41. mask = 0xff << (bit + 1); 42. 43. buf = OPENSSL_malloc(bytes); ^ 44. if (buf == NULL) { 45. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/bn/bn_rand.c:43:5: Assignment 41. mask = 0xff << (bit + 1); 42. 43. buf = OPENSSL_malloc(bytes); ^ 44. if (buf == NULL) { 45. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/bn/bn_rand.c:88:9: Array access: Offset: [-1, 518] Size: [1, 519] by call to `BN_rand` 86. buf[0] &= ~mask; 87. if (bottom) /* set bottom bit if requested */ 88. buf[bytes - 1] |= 1; ^ 89. if (!BN_bin2bn(buf, bytes, rnd)) 90. goto err;
https://github.com/openssl/openssl/blob/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_rand.c/#L88
d2a_code_trace_data_42801
static av_always_inline int epzs_motion_search_internal(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, int flags, int size, int h) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d; int dmin; int map_generation; int penalty_factor; 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 LOAD_COMMON2 if(c->pre_pass){ penalty_factor= c->pre_penalty_factor; cmpf= s->dsp.me_pre_cmp[size]; chroma_cmpf= s->dsp.me_pre_cmp[size+1]; }else{ penalty_factor= c->penalty_factor; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; } map_generation= update_map_generation(c); assert(cmpf); dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags); map[0]= map_generation; score_map[0]= dmin; if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0) dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor; 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) }else{ if(dmin<((h*h*s->avctx->mv0_threshold)>>8) && ( P_LEFT[0] |P_LEFT[1] |P_TOP[0] |P_TOP[1] |P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){ *mx_ptr= 0; *my_ptr= 0; c->skip=1; return dmin; } CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[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_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) } if(dmin>h*h*4){ if(c->pre_pass){ 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->first_slice_line) 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) }else{ 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) } } if(c->avctx->last_predictor_count){ const int count= c->avctx->last_predictor_count; const int xstart= FFMAX(0, s->mb_x - count); const int ystart= FFMAX(0, s->mb_y - count); const int xend= FFMIN(s->mb_width , s->mb_x + count + 1); const int yend= FFMIN(s->mb_height, s->mb_y + count + 1); int mb_y; for(mb_y=ystart; mb_y<yend; mb_y++){ int mb_x; for(mb_x=xstart; mb_x<xend; mb_x++){ const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride; int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16; int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16; if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; CHECK_MV(mx,my) } } } 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:1044: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:1044:9: 1042. if (s->first_slice_line) { 1043. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) 1044. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, ^ 1045. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) 1046. }else{
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1044
d2a_code_trace_data_42802
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:1164: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:1164:9: 1162. CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) 1163. }else{ 1164. CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) ^ 1165. //FIXME try some early stop 1166. CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1164
d2a_code_trace_data_42803
static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) { const tls_curve_info *cinfo; if (curve[0]) return 1; if ((curve[1] < 1) || ((size_t)curve[1] > sizeof(nid_list) / sizeof(nid_list[0]))) return 0; cinfo = &nid_list[curve[1] - 1]; # ifdef OPENSSL_NO_EC2M if (cinfo->flags & TLS_CURVE_CHAR2) return 0; # endif return ssl_security(s, op, cinfo->secbits, cinfo->nid, (void *)curve); } ssl/s3_clnt.c:351: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: 28 by call to `ssl3_get_key_exchange`. Showing all 11 steps of the trace ssl/s3_clnt.c:182:1: Parameter `*s->init_msg` 180. ssl3_connect, ssl3_get_client_method) 181. #endif 182. > int ssl3_connect(SSL *s) 183. { 184. BUF_MEM *buf = NULL; ssl/s3_clnt.c:351:19: Call 349. case SSL3_ST_CR_KEY_EXCH_A: 350. case SSL3_ST_CR_KEY_EXCH_B: 351. ret = ssl3_get_key_exchange(s); ^ 352. if (ret <= 0) 353. goto end; ssl/s3_clnt.c:1318:1: Parameter `*s->init_msg` 1316. } 1317. 1318. > int ssl3_get_key_exchange(SSL *s) 1319. { 1320. #ifndef OPENSSL_NO_RSA ssl/s3_clnt.c:1768:14: Call 1766. * invalid curve. ECParameters is 3 bytes. 1767. */ 1768. if (!tls1_check_curve(s, p, 3)) { ^ 1769. SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_WRONG_CURVE); 1770. goto f_err; ssl/t1_lib.c:273:1: Array declaration 271. }; 272. 273. > static const unsigned char eccurves_default[] = { 274. 0, 14, /* sect571r1 (14) */ 275. 0, 13, /* sect571k1 (13) */ ssl/t1_lib.c:484:20: Call 482. for (i = 0; i < num_curves; i++, curves += 2) { 483. if (p[1] == curves[0] && p[2] == curves[1]) 484. return tls_curve_allowed(s, p + 1, SSL_SECOP_CURVE_CHECK); ^ 485. } 486. return 0; ssl/t1_lib.c:442:1: <Offset trace> 440. 441. /* See if curve is allowed by security callback */ 442. > static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) 443. { 444. const tls_curve_info *cinfo; ssl/t1_lib.c:442:1: Parameter `*curve` 440. 441. /* See if curve is allowed by security callback */ 442. > static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) 443. { 444. const tls_curve_info *cinfo; ssl/t1_lib.c:236:1: <Length trace> 234. # define TLS_CURVE_PRIME 0x0 235. 236. > static const tls_curve_info nid_list[] = { 237. {NID_sect163k1, 80, TLS_CURVE_CHAR2}, /* sect163k1 (1) */ 238. {NID_sect163r1, 80, TLS_CURVE_CHAR2}, /* sect163r1 (2) */ ssl/t1_lib.c:236:1: Array declaration 234. # define TLS_CURVE_PRIME 0x0 235. 236. > static const tls_curve_info nid_list[] = { 237. {NID_sect163k1, 80, TLS_CURVE_CHAR2}, /* sect163k1 (1) */ 238. {NID_sect163r1, 80, TLS_CURVE_CHAR2}, /* sect163r1 (2) */ ssl/t1_lib.c:450:5: Array access: Offset: [-1, +oo] Size: 28 by call to `ssl3_get_key_exchange` 448. sizeof(nid_list) / sizeof(nid_list[0]))) 449. return 0; 450. cinfo = &nid_list[curve[1] - 1]; ^ 451. # ifdef OPENSSL_NO_EC2M 452. if (cinfo->flags & TLS_CURVE_CHAR2)
https://github.com/openssl/openssl/blob/9c46f4b9cd4912b61cb546c48b678488d7f26ed6/ssl/t1_lib.c/#L450
d2a_code_trace_data_42804
static void frame_end(MpegEncContext *s) { int i; if (s->unrestricted_mv && s->current_picture.reference && !s->intra_only) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); int hshift = desc->log2_chroma_w; int vshift = desc->log2_chroma_h; s->mpvencdsp.draw_edges(s->current_picture.f->data[0], s->linesize, s->h_edge_pos, s->v_edge_pos, EDGE_WIDTH, EDGE_WIDTH, EDGE_TOP | EDGE_BOTTOM); s->mpvencdsp.draw_edges(s->current_picture.f->data[1], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); s->mpvencdsp.draw_edges(s->current_picture.f->data[2], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); } emms_c(); s->last_pict_type = s->pict_type; s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f->quality; if (s->pict_type!= AV_PICTURE_TYPE_B) s->last_non_b_pict_type = s->pict_type; if (s->encoding) { for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (!s->picture[i].reference) ff_mpeg_unref_picture(s->avctx, &s->picture[i]); } } #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS av_frame_copy_props(s->avctx->coded_frame, s->current_picture.f); FF_ENABLE_DEPRECATION_WARNINGS #endif #if FF_API_ERROR_FRAME FF_DISABLE_DEPRECATION_WARNINGS memcpy(s->current_picture.f->error, s->current_picture.encoding_error, sizeof(s->current_picture.encoding_error)); FF_ENABLE_DEPRECATION_WARNINGS #endif } libavcodec/mpegvideo_enc.c:1442: error: Null Dereference pointer `desc` last assigned on line 1441 could be null and is dereferenced at line 1442, column 22. libavcodec/mpegvideo_enc.c:1434:1: start of procedure frame_end() 1432. } 1433. 1434. static void frame_end(MpegEncContext *s) ^ 1435. { 1436. int i; libavcodec/mpegvideo_enc.c:1438:9: Taking true branch 1436. int i; 1437. 1438. if (s->unrestricted_mv && ^ 1439. s->current_picture.reference && 1440. !s->intra_only) { libavcodec/mpegvideo_enc.c:1439:9: Taking true branch 1437. 1438. if (s->unrestricted_mv && 1439. s->current_picture.reference && ^ 1440. !s->intra_only) { 1441. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); libavcodec/mpegvideo_enc.c:1440:10: Taking true branch 1438. if (s->unrestricted_mv && 1439. s->current_picture.reference && 1440. !s->intra_only) { ^ 1441. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 1442. int hshift = desc->log2_chroma_w; libavcodec/mpegvideo_enc.c:1441:9: 1439. s->current_picture.reference && 1440. !s->intra_only) { 1441. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); ^ 1442. int hshift = desc->log2_chroma_w; 1443. int vshift = desc->log2_chroma_h; libavutil/pixdesc.c:1686:1: start of procedure av_pix_fmt_desc_get() 1684. } 1685. 1686. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1687. { 1688. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1688:9: Taking false branch 1686. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1687. { 1688. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1689. return NULL; 1690. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1688:24: Taking true branch 1686. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1687. { 1688. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1689. return NULL; 1690. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1689:9: 1687. { 1688. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1689. return NULL; ^ 1690. return &av_pix_fmt_descriptors[pix_fmt]; 1691. } libavutil/pixdesc.c:1691:1: return from a call to av_pix_fmt_desc_get 1689. return NULL; 1690. return &av_pix_fmt_descriptors[pix_fmt]; 1691. } ^ 1692. 1693. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libavcodec/mpegvideo_enc.c:1442:9: 1440. !s->intra_only) { 1441. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 1442. int hshift = desc->log2_chroma_w; ^ 1443. int vshift = desc->log2_chroma_h; 1444. s->mpvencdsp.draw_edges(s->current_picture.f->data[0], s->linesize,
https://github.com/libav/libav/blob/27eeee76b2546fd313808997b3d07ba9cce94551/libavcodec/mpegvideo_enc.c/#L1442
d2a_code_trace_data_42805
static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) { unsigned char *buf = NULL; int ret = 0, bit, bytes, mask; time_t tim; if (bits == 0) { if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) goto toosmall; BN_zero(rnd); return 1; } if (bits < 0 || (bits == 1 && top > 0)) goto toosmall; bytes = (bits + 7) / 8; bit = (bits - 1) % 8; mask = 0xff << (bit + 1); buf = OPENSSL_malloc(bytes); if (buf == NULL) { BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); goto err; } time(&tim); RAND_add(&tim, sizeof(tim), 0.0); if (RAND_bytes(buf, bytes) <= 0) goto err; if (pseudorand == 2) { int i; unsigned char c; for (i = 0; i < bytes; i++) { if (RAND_bytes(&c, 1) <= 0) goto err; if (c >= 128 && i > 0) buf[i] = buf[i - 1]; else if (c < 42) buf[i] = 0; else if (c < 84) buf[i] = 255; } } if (top >= 0) { if (top) { if (bit == 0) { buf[0] = 1; buf[1] |= 0x80; } else { buf[0] |= (3 << (bit - 1)); } } else { buf[0] |= (1 << bit); } } buf[0] &= ~mask; if (bottom) buf[bytes - 1] |= 1; if (!BN_bin2bn(buf, bytes, rnd)) goto err; ret = 1; err: OPENSSL_clear_free(buf, bytes); bn_check_top(rnd); return (ret); toosmall: BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL); return 0; } test/bntest.c:408: error: BUFFER_OVERRUN_L3 Offset: [-1, 518] Size: [1, 519] by call to `BN_rand`. Showing all 12 steps of the trace test/bntest.c:408:9: Call 406. 407. for (i = 0; i < NUM0; i++) { 408. BN_rand(a, 512, 0, 0); ^ 409. BN_copy(b, BN_value_one()); 410. a->neg = rand_neg(); crypto/bn/bn_rand.c:96:1: Parameter `bits` 94. } 95. 96. > int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 97. { 98. return bnrand(0, rnd, bits, top, bottom); crypto/bn/bn_rand.c:98:12: Call 96. int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 97. { 98. return bnrand(0, rnd, bits, top, bottom); ^ 99. } 100. crypto/bn/bn_rand.c:56:14: <Offset trace> 54. unsigned char c; 55. 56. for (i = 0; i < bytes; i++) { ^ 57. if (RAND_bytes(&c, 1) <= 0) 58. goto err; crypto/bn/bn_rand.c:56:14: Assignment 54. unsigned char c; 55. 56. for (i = 0; i < bytes; i++) { ^ 57. if (RAND_bytes(&c, 1) <= 0) 58. goto err; crypto/bn/bn_rand.c:17:1: <Length trace> 15. #include <openssl/sha.h> 16. 17. > static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) 18. { 19. unsigned char *buf = NULL; crypto/bn/bn_rand.c:17:1: Parameter `bits` 15. #include <openssl/sha.h> 16. 17. > static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) 18. { 19. unsigned char *buf = NULL; crypto/bn/bn_rand.c:32:5: Assignment 30. goto toosmall; 31. 32. bytes = (bits + 7) / 8; ^ 33. bit = (bits - 1) % 8; 34. mask = 0xff << (bit + 1); crypto/bn/bn_rand.c:36:11: Call 34. mask = 0xff << (bit + 1); 35. 36. buf = OPENSSL_malloc(bytes); ^ 37. if (buf == NULL) { 38. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/mem.c:79:9: Assignment 77. 78. if (num <= 0) 79. return NULL; ^ 80. 81. allow_customize = 0; crypto/bn/bn_rand.c:36:5: Assignment 34. mask = 0xff << (bit + 1); 35. 36. buf = OPENSSL_malloc(bytes); ^ 37. if (buf == NULL) { 38. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/bn/bn_rand.c:82:9: Array access: Offset: [-1, 518] Size: [1, 519] by call to `BN_rand` 80. buf[0] &= ~mask; 81. if (bottom) /* set bottom bit if requested */ 82. buf[bytes - 1] |= 1; ^ 83. if (!BN_bin2bn(buf, bytes, rnd)) 84. goto err;
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_rand.c/#L82
d2a_code_trace_data_42806
static void pred8x8l_down_left_c(uint8_t *src, int has_topleft, int has_topright, int stride) { PREDICT_8x8_LOAD_TOP; PREDICT_8x8_LOAD_TOPRIGHT; SRC(0,0)= (t0 + 2*t1 + t2 + 2) >> 2; SRC(0,1)=SRC(1,0)= (t1 + 2*t2 + t3 + 2) >> 2; SRC(0,2)=SRC(1,1)=SRC(2,0)= (t2 + 2*t3 + t4 + 2) >> 2; SRC(0,3)=SRC(1,2)=SRC(2,1)=SRC(3,0)= (t3 + 2*t4 + t5 + 2) >> 2; SRC(0,4)=SRC(1,3)=SRC(2,2)=SRC(3,1)=SRC(4,0)= (t4 + 2*t5 + t6 + 2) >> 2; SRC(0,5)=SRC(1,4)=SRC(2,3)=SRC(3,2)=SRC(4,1)=SRC(5,0)= (t5 + 2*t6 + t7 + 2) >> 2; SRC(0,6)=SRC(1,5)=SRC(2,4)=SRC(3,3)=SRC(4,2)=SRC(5,1)=SRC(6,0)= (t6 + 2*t7 + t8 + 2) >> 2; SRC(0,7)=SRC(1,6)=SRC(2,5)=SRC(3,4)=SRC(4,3)=SRC(5,2)=SRC(6,1)=SRC(7,0)= (t7 + 2*t8 + t9 + 2) >> 2; SRC(1,7)=SRC(2,6)=SRC(3,5)=SRC(4,4)=SRC(5,3)=SRC(6,2)=SRC(7,1)= (t8 + 2*t9 + t10 + 2) >> 2; SRC(2,7)=SRC(3,6)=SRC(4,5)=SRC(5,4)=SRC(6,3)=SRC(7,2)= (t9 + 2*t10 + t11 + 2) >> 2; SRC(3,7)=SRC(4,6)=SRC(5,5)=SRC(6,4)=SRC(7,3)= (t10 + 2*t11 + t12 + 2) >> 2; SRC(4,7)=SRC(5,6)=SRC(6,5)=SRC(7,4)= (t11 + 2*t12 + t13 + 2) >> 2; SRC(5,7)=SRC(6,6)=SRC(7,5)= (t12 + 2*t13 + t14 + 2) >> 2; SRC(6,7)=SRC(7,6)= (t13 + 2*t14 + t15 + 2) >> 2; SRC(7,7)= (t14 + 3*t15 + 2) >> 2; } libavcodec/h264pred.c:843: error: Uninitialized Value The value read from t7 was never initialized. libavcodec/h264pred.c:843:68: 841. SRC(0,5)=SRC(1,4)=SRC(2,3)=SRC(3,2)=SRC(4,1)=SRC(5,0)= (t5 + 2*t6 + t7 + 2) >> 2; 842. SRC(0,6)=SRC(1,5)=SRC(2,4)=SRC(3,3)=SRC(4,2)=SRC(5,1)=SRC(6,0)= (t6 + 2*t7 + t8 + 2) >> 2; 843. SRC(0,7)=SRC(1,6)=SRC(2,5)=SRC(3,4)=SRC(4,3)=SRC(5,2)=SRC(6,1)=SRC(7,0)= (t7 + 2*t8 + t9 + 2) >> 2; ^ 844. SRC(1,7)=SRC(2,6)=SRC(3,5)=SRC(4,4)=SRC(5,3)=SRC(6,2)=SRC(7,1)= (t8 + 2*t9 + t10 + 2) >> 2; 845. SRC(2,7)=SRC(3,6)=SRC(4,5)=SRC(5,4)=SRC(6,3)=SRC(7,2)= (t9 + 2*t10 + t11 + 2) >> 2;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264pred.c/#L843
d2a_code_trace_data_42807
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } crypto/dsa/dsa_gen.c:503: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex`. Showing all 49 steps of the trace crypto/dsa/dsa_gen.c:390:10: Call 388. } 389. 390. if (!BN_lshift(test, BN_value_one(), L - 1)) ^ 391. goto err; 392. for (;;) { crypto/bn/bn_shift.c:83:1: Parameter `r->top` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/dsa/dsa_gen.c:503:21: Call 501. if (BN_cmp(p, test) >= 0) { 502. /* step 11 */ 503. r = BN_is_prime_fasttest_ex(p, DSS_prime_checks, ctx, 1, cb); ^ 504. if (r > 0) 505. goto end; /* found it */ crypto/bn/bn_prime.c:151:1: Parameter `a->top` 149. } 150. 151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 152. int do_trial_division, BN_GENCB *cb) 153. { crypto/bn/bn_prime.c:161:9: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_prime.c:161:29: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_prime.c:165:10: Call 163. 164. /* Check odd and bigger than 1 */ 165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0) ^ 166. return 0; 167. crypto/bn/bn_lib.c:860:1: Parameter `a->top` 858. } 859. 860. > int BN_is_odd(const BIGNUM *a) 861. { 862. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_prime.c:165:26: Call 163. 164. /* Check odd and bigger than 1 */ 165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0) ^ 166. return 0; 167. crypto/bn/bn_lib.c:542:1: Parameter `a->top` 540. } 541. 542. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 543. { 544. int i; crypto/bn/bn_prime.c:198:10: Call 196. 197. /* compute A1 := a - 1 */ 198. if (!BN_copy(A1, a) || !BN_sub_word(A1, 1)) ^ 199. goto err; 200. /* compute A3 := a - 3 */ crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:201:10: Call 199. goto err; 200. /* compute A3 := a - 3 */ 201. if (!BN_copy(A3, a) || !BN_sub_word(A3, 3)) ^ 202. goto err; 203. crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:215:10: Call 213. if (mont == NULL) 214. goto err; 215. if (!BN_MONT_CTX_set(mont, a, ctx)) ^ 216. goto err; 217. crypto/bn/bn_mont.c:238:9: Call 236. BIGNUM *Ri, *R; 237. 238. if (BN_is_zero(mod)) ^ 239. return 0; 240. crypto/bn/bn_lib.c:845:1: Parameter `a->top` 843. } 844. 845. > int BN_is_zero(const BIGNUM *a) 846. { 847. return a->top == 0; crypto/bn/bn_prime.c:223:13: Call 221. goto err; 222. 223. j = witness(check, a, A1, A1_odd, k, ctx, mont); ^ 224. if (j == -1) 225. goto err; crypto/bn/bn_prime.c:245:1: Parameter `a->top` 243. } 244. 245. > static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, 246. const BIGNUM *a1_odd, int k, BN_CTX *ctx, 247. BN_MONT_CTX *mont) crypto/bn/bn_prime.c:249:10: Call 247. BN_MONT_CTX *mont) 248. { 249. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */ ^ 250. return -1; 251. if (BN_is_one(w)) crypto/bn/bn_exp.c:296:1: Parameter `m->top` 294. } 295. 296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 298. { crypto/bn/bn_exp.c:310:16: Call 308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { 310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 311. } 312. crypto/bn/bn_exp.c:745:14: Assignment 743. /* 2^(top*BN_BITS2) - m */ 744. tmp.d[0] = (0 - m->d[0]) & BN_MASK2; 745. for (i = 1; i < top; i++) ^ 746. tmp.d[i] = (~m->d[i]) & BN_MASK2; 747. tmp.top = top; crypto/bn/bn_exp.c:1062:14: Call 1060. bits -= window0; 1061. wvalue = bn_get_bits(p, bits) & wmask; 1062. if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue, ^ 1063. window)) 1064. goto err; crypto/bn/bn_exp.c:520:1: Parameter `top` 518. } 519. 520. > static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top, 521. unsigned char *buf, int idx, 522. int window) crypto/bn/bn_exp.c:577:5: Assignment 575. } 576. 577. b->top = top; ^ 578. bn_correct_top(b); 579. return 1; crypto/bn/bn_exp.c:578:5: Call 576. 577. b->top = top; 578. bn_correct_top(b); ^ 579. return 1; 580. } crypto/bn/bn_lib.c:946:1: Parameter `a->top` 944. } 945. 946. > void bn_correct_top(BIGNUM *a) 947. { 948. BN_ULONG *ftl; crypto/bn/bn_exp.c:1075:22: Call 1073. /* Square the result window-size times */ 1074. for (i = 0; i < window; i++) 1075. if (!BN_mod_mul_montgomery(&tmp, &tmp, &tmp, mont, ctx)) ^ 1076. goto err; 1077. crypto/bn/bn_mont.c:26:1: Parameter `a->top` 24. #endif 25. 26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { crypto/bn/bn_mont.c:53:14: Call 51. bn_check_top(tmp); 52. if (a == b) { 53. if (!BN_sqr(tmp, a, ctx)) ^ 54. goto err; 55. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:105:1: <Offset trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `n` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:116:5: Assignment 114. rp[0] = rp[max - 1] = 0; 115. rp++; 116. j = n; ^ 117. 118. if (--j > 0) { crypto/bn/bn_sqr.c:118:9: Assignment 116. j = n; 117. 118. if (--j > 0) { ^ 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:105:1: <Length trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `*r` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:113:5: Assignment 111. max = n * 2; 112. ap = a; 113. rp = r; ^ 114. rp[0] = rp[max - 1] = 0; 115. rp++; crypto/bn/bn_sqr.c:115:5: Assignment 113. rp = r; 114. rp[0] = rp[max - 1] = 0; 115. rp++; ^ 116. j = n; 117. crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex` 118. if (--j > 0) { 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 121. rp += 2; 122. }
https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_sqr.c/#L120
d2a_code_trace_data_42808
int opt_verify(int opt, X509_VERIFY_PARAM *vpm) { int i; ossl_intmax_t t = 0; ASN1_OBJECT *otmp; X509_PURPOSE *xptmp; const X509_VERIFY_PARAM *vtmp; assert(vpm != NULL); assert(opt > OPT_V__FIRST); assert(opt < OPT_V__LAST); switch ((enum range)opt) { case OPT_V__FIRST: case OPT_V__LAST: return 0; case OPT_V_POLICY: otmp = OBJ_txt2obj(opt_arg(), 0); if (otmp == NULL) { BIO_printf(bio_err, "%s: Invalid Policy %s\n", prog, opt_arg()); return 0; } X509_VERIFY_PARAM_add0_policy(vpm, otmp); break; case OPT_V_PURPOSE: i = X509_PURPOSE_get_by_sname(opt_arg()); if (i < 0) { BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg()); return 0; } xptmp = X509_PURPOSE_get0(i); i = X509_PURPOSE_get_id(xptmp); if (!X509_VERIFY_PARAM_set_purpose(vpm, i)) { BIO_printf(bio_err, "%s: Internal error setting purpose %s\n", prog, opt_arg()); return 0; } break; case OPT_V_VERIFY_NAME: vtmp = X509_VERIFY_PARAM_lookup(opt_arg()); if (vtmp == NULL) { BIO_printf(bio_err, "%s: Invalid verify name %s\n", prog, opt_arg()); return 0; } X509_VERIFY_PARAM_set1(vpm, vtmp); break; case OPT_V_VERIFY_DEPTH: i = atoi(opt_arg()); if (i >= 0) X509_VERIFY_PARAM_set_depth(vpm, i); break; case OPT_V_ATTIME: if (!opt_imax(opt_arg(), &t)) return 0; if (t != (time_t)t) { BIO_printf(bio_err, "%s: epoch time out of range %s\n", prog, opt_arg()); return 0; } X509_VERIFY_PARAM_set_time(vpm, (time_t)t); break; case OPT_V_VERIFY_HOSTNAME: if (!X509_VERIFY_PARAM_set1_host(vpm, opt_arg(), 0)) return 0; break; case OPT_V_VERIFY_EMAIL: if (!X509_VERIFY_PARAM_set1_email(vpm, opt_arg(), 0)) return 0; break; case OPT_V_VERIFY_IP: if (!X509_VERIFY_PARAM_set1_ip_asc(vpm, opt_arg())) return 0; break; case OPT_V_IGNORE_CRITICAL: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_IGNORE_CRITICAL); break; case OPT_V_ISSUER_CHECKS: break; case OPT_V_CRL_CHECK: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_CRL_CHECK); break; case OPT_V_CRL_CHECK_ALL: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL); break; case OPT_V_POLICY_CHECK: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_POLICY_CHECK); break; case OPT_V_EXPLICIT_POLICY: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_EXPLICIT_POLICY); break; case OPT_V_INHIBIT_ANY: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_INHIBIT_ANY); break; case OPT_V_INHIBIT_MAP: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_INHIBIT_MAP); break; case OPT_V_X509_STRICT: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_X509_STRICT); break; case OPT_V_EXTENDED_CRL: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_EXTENDED_CRL_SUPPORT); break; case OPT_V_USE_DELTAS: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_USE_DELTAS); break; case OPT_V_POLICY_PRINT: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_NOTIFY_POLICY); break; case OPT_V_CHECK_SS_SIG: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_CHECK_SS_SIGNATURE); break; case OPT_V_TRUSTED_FIRST: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_TRUSTED_FIRST); break; case OPT_V_SUITEB_128_ONLY: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_SUITEB_128_LOS_ONLY); break; case OPT_V_SUITEB_128: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_SUITEB_128_LOS); break; case OPT_V_SUITEB_192: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_SUITEB_192_LOS); break; case OPT_V_PARTIAL_CHAIN: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_PARTIAL_CHAIN); break; case OPT_V_NO_ALT_CHAINS: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_NO_ALT_CHAINS); break; case OPT_V_NO_CHECK_TIME: X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_NO_CHECK_TIME); break; } return 1; } apps/opt.c:506: error: NULL_DEREFERENCE pointer `xptmp` last assigned on line 503 could be null and is dereferenced by call to `X509_PURPOSE_get_id()` at line 506, column 13. Showing all 31 steps of the trace apps/opt.c:470:1: start of procedure opt_verify() 468. enum range { OPT_V_ENUM }; 469. 470. > int opt_verify(int opt, X509_VERIFY_PARAM *vpm) 471. { 472. int i; apps/opt.c:473:5: 471. { 472. int i; 473. > ossl_intmax_t t = 0; 474. ASN1_OBJECT *otmp; 475. X509_PURPOSE *xptmp; apps/opt.c:478:5: 476. const X509_VERIFY_PARAM *vtmp; 477. 478. > assert(vpm != NULL); 479. assert(opt > OPT_V__FIRST); 480. assert(opt < OPT_V__LAST); apps/opt.c:479:5: 477. 478. assert(vpm != NULL); 479. > assert(opt > OPT_V__FIRST); 480. assert(opt < OPT_V__LAST); 481. apps/opt.c:480:5: 478. assert(vpm != NULL); 479. assert(opt > OPT_V__FIRST); 480. > assert(opt < OPT_V__LAST); 481. 482. switch ((enum range)opt) { apps/opt.c:482:5: 480. assert(opt < OPT_V__LAST); 481. 482. > switch ((enum range)opt) { 483. case OPT_V__FIRST: 484. case OPT_V__LAST: apps/opt.c:483:5: Switch condition is false. Skipping switch case 481. 482. switch ((enum range)opt) { 483. case OPT_V__FIRST: ^ 484. case OPT_V__LAST: 485. return 0; apps/opt.c:484:5: Switch condition is false. Skipping switch case 482. switch ((enum range)opt) { 483. case OPT_V__FIRST: 484. case OPT_V__LAST: ^ 485. return 0; 486. case OPT_V_POLICY: apps/opt.c:486:5: Switch condition is false. Skipping switch case 484. case OPT_V__LAST: 485. return 0; 486. case OPT_V_POLICY: ^ 487. otmp = OBJ_txt2obj(opt_arg(), 0); 488. if (otmp == NULL) { apps/opt.c:494:5: Switch condition is true. Entering switch case 492. X509_VERIFY_PARAM_add0_policy(vpm, otmp); 493. break; 494. case OPT_V_PURPOSE: ^ 495. /* purpose name -> purpose index */ 496. i = X509_PURPOSE_get_by_sname(opt_arg()); apps/opt.c:496:9: 494. case OPT_V_PURPOSE: 495. /* purpose name -> purpose index */ 496. > i = X509_PURPOSE_get_by_sname(opt_arg()); 497. if (i < 0) { 498. BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg()); apps/opt.c:775:1: start of procedure opt_arg() 773. 774. /* Return the most recent flag parameter. */ 775. > char *opt_arg(void) 776. { 777. return arg; apps/opt.c:777:5: 775. char *opt_arg(void) 776. { 777. > return arg; 778. } 779. apps/opt.c:778:1: return from a call to opt_arg 776. { 777. return arg; 778. > } 779. 780. /* Return the most recent flag. */ apps/opt.c:496:9: Skipping X509_PURPOSE_get_by_sname(): empty list of specs 494. case OPT_V_PURPOSE: 495. /* purpose name -> purpose index */ 496. i = X509_PURPOSE_get_by_sname(opt_arg()); ^ 497. if (i < 0) { 498. BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg()); apps/opt.c:497:13: Taking false branch 495. /* purpose name -> purpose index */ 496. i = X509_PURPOSE_get_by_sname(opt_arg()); 497. if (i < 0) { ^ 498. BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg()); 499. return 0; apps/opt.c:503:9: 501. 502. /* purpose index -> purpose object */ 503. > xptmp = X509_PURPOSE_get0(i); 504. 505. /* purpose object -> purpose value */ crypto/x509v3/v3_purp.c:162:1: start of procedure X509_PURPOSE_get0() 160. } 161. 162. > X509_PURPOSE *X509_PURPOSE_get0(int idx) 163. { 164. if (idx < 0) crypto/x509v3/v3_purp.c:164:9: Taking false branch 162. X509_PURPOSE *X509_PURPOSE_get0(int idx) 163. { 164. if (idx < 0) ^ 165. return NULL; 166. if (idx < (int)X509_PURPOSE_COUNT) crypto/x509v3/v3_purp.c:166:9: Taking false branch 164. if (idx < 0) 165. return NULL; 166. if (idx < (int)X509_PURPOSE_COUNT) ^ 167. return xstandard + idx; 168. return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT); crypto/x509v3/v3_purp.c:168:5: 166. if (idx < (int)X509_PURPOSE_COUNT) 167. return xstandard + idx; 168. > return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT); 169. } 170. include/openssl/x509v3.h:499:1: start of procedure sk_X509_PURPOSE_value() 497. # define X509V3_ADD_SILENT 0x10 498. 499. > DEFINE_STACK_OF(X509_PURPOSE) 500. 501. DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) crypto/stack/stack.c:323:1: start of procedure sk_value() 321. } 322. 323. > void *sk_value(const _STACK *st, int i) 324. { 325. if (!st || (i < 0) || (i >= st->num)) crypto/stack/stack.c:325:10: Taking true branch 323. void *sk_value(const _STACK *st, int i) 324. { 325. if (!st || (i < 0) || (i >= st->num)) ^ 326. return NULL; 327. return st->data[i]; crypto/stack/stack.c:326:9: 324. { 325. if (!st || (i < 0) || (i >= st->num)) 326. > return NULL; 327. return st->data[i]; 328. } crypto/stack/stack.c:328:1: return from a call to sk_value 326. return NULL; 327. return st->data[i]; 328. > } 329. 330. void *sk_set(_STACK *st, int i, void *value) include/openssl/x509v3.h:499:1: return from a call to sk_X509_PURPOSE_value 497. # define X509V3_ADD_SILENT 0x10 498. 499. > DEFINE_STACK_OF(X509_PURPOSE) 500. 501. DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) crypto/x509v3/v3_purp.c:169:1: return from a call to X509_PURPOSE_get0 167. return xstandard + idx; 168. return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT); 169. > } 170. 171. int X509_PURPOSE_get_by_sname(char *sname) apps/opt.c:506:9: 504. 505. /* purpose object -> purpose value */ 506. > i = X509_PURPOSE_get_id(xptmp); 507. 508. if (!X509_VERIFY_PARAM_set_purpose(vpm, i)) { crypto/x509v3/v3_purp.c:281:1: start of procedure X509_PURPOSE_get_id() 279. } 280. 281. > int X509_PURPOSE_get_id(X509_PURPOSE *xp) 282. { 283. return xp->purpose; crypto/x509v3/v3_purp.c:283:5: 281. int X509_PURPOSE_get_id(X509_PURPOSE *xp) 282. { 283. > return xp->purpose; 284. } 285.
https://github.com/openssl/openssl/blob/2d5a1cfab8af8a282c62a3e1562aab1ad905b3e9/apps/opt.c/#L506
d2a_code_trace_data_42809
void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur, Picture *last, int y, int h, int picture_structure, int first_field, int draw_edges, int low_delay, int v_edge_pos, int h_edge_pos) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); int hshift = desc->log2_chroma_w; int vshift = desc->log2_chroma_h; const int field_pic = picture_structure != PICT_FRAME; if(field_pic){ h <<= 1; y <<= 1; } if (!avctx->hwaccel && draw_edges && cur->reference && !(avctx->flags & CODEC_FLAG_EMU_EDGE)) { int *linesize = cur->f.linesize; int sides = 0, edge_h; if (y==0) sides |= EDGE_TOP; if (y + h >= v_edge_pos) sides |= EDGE_BOTTOM; edge_h= FFMIN(h, v_edge_pos - y); dsp->draw_edges(cur->f.data[0] + y * linesize[0], linesize[0], h_edge_pos, edge_h, EDGE_WIDTH, EDGE_WIDTH, sides); dsp->draw_edges(cur->f.data[1] + (y >> vshift) * linesize[1], linesize[1], h_edge_pos >> hshift, edge_h >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, sides); dsp->draw_edges(cur->f.data[2] + (y >> vshift) * linesize[2], linesize[2], h_edge_pos >> hshift, edge_h >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, sides); } h = FFMIN(h, avctx->height - y); if(field_pic && first_field && !(avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)) return; if (avctx->draw_horiz_band) { AVFrame *src; int offset[AV_NUM_DATA_POINTERS]; int i; if(cur->f.pict_type == AV_PICTURE_TYPE_B || low_delay || (avctx->slice_flags & SLICE_FLAG_CODED_ORDER)) src = &cur->f; else if (last) src = &last->f; else return; if (cur->f.pict_type == AV_PICTURE_TYPE_B && picture_structure == PICT_FRAME && avctx->codec_id != AV_CODEC_ID_SVQ3) { for (i = 0; i < AV_NUM_DATA_POINTERS; i++) offset[i] = 0; }else{ offset[0]= y * src->linesize[0]; offset[1]= offset[2]= (y >> vshift) * src->linesize[1]; for (i = 3; i < AV_NUM_DATA_POINTERS; i++) offset[i] = 0; } emms_c(); avctx->draw_horiz_band(avctx, src, offset, y, picture_structure, h); } } libavcodec/mpegvideo.c:2234: error: Null Dereference pointer `desc` last assigned on line 2233 could be null and is dereferenced at line 2234, column 18. libavcodec/mpegvideo.c:2228:1: start of procedure ff_draw_horiz_band() 2226. * @param h is the normal height, this will be reduced automatically if needed for the last row 2227. */ 2228. void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur, ^ 2229. Picture *last, int y, int h, int picture_structure, 2230. int first_field, int draw_edges, int low_delay, libavcodec/mpegvideo.c:2233:5: 2231. int v_edge_pos, int h_edge_pos) 2232. { 2233. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); ^ 2234. int hshift = desc->log2_chroma_w; 2235. int vshift = desc->log2_chroma_h; libavutil/pixdesc.c:1507:1: start of procedure av_pix_fmt_desc_get() 1505. } 1506. 1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1509:9: Taking false branch 1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1510. return NULL; 1511. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1509:24: Taking true branch 1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1510. return NULL; 1511. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1510:9: 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1510. return NULL; ^ 1511. return &av_pix_fmt_descriptors[pix_fmt]; 1512. } libavutil/pixdesc.c:1512:1: return from a call to av_pix_fmt_desc_get 1510. return NULL; 1511. return &av_pix_fmt_descriptors[pix_fmt]; 1512. } ^ 1513. 1514. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libavcodec/mpegvideo.c:2234:5: 2232. { 2233. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); 2234. int hshift = desc->log2_chroma_w; ^ 2235. int vshift = desc->log2_chroma_h; 2236. const int field_pic = picture_structure != PICT_FRAME;
https://github.com/libav/libav/blob/16e7b189c548b4075ff4b5dd62af10e2acae260b/libavcodec/mpegvideo.c/#L2234
d2a_code_trace_data_42810
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_sp800_56b_gen.c:208: error: INTEGER_OVERFLOW_L2 ([0, 6+max(0, `ctx->stack.depth`)] - 1):unsigned32 by call to `BN_mod_inverse`. Showing all 57 steps of the trace crypto/rsa/rsa_sp800_56b_gen.c:180:1: Parameter `ctx->stack.depth` 178. * 1 = success. 179. */ 180. > int rsa_sp800_56b_derive_params_from_pq(RSA *rsa, int nbits, 181. const BIGNUM *e, BN_CTX *ctx) 182. { crypto/rsa/rsa_sp800_56b_gen.c:186:5: Call 184. BIGNUM *p1, *q1, *lcm, *p1q1, *gcd; 185. 186. BN_CTX_start(ctx); ^ 187. p1 = BN_CTX_get(ctx); 188. q1 = 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/rsa/rsa_sp800_56b_gen.c:187:10: Call 185. 186. BN_CTX_start(ctx); 187. p1 = BN_CTX_get(ctx); ^ 188. q1 = BN_CTX_get(ctx); 189. lcm = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/rsa/rsa_sp800_56b_gen.c:188:10: Call 186. BN_CTX_start(ctx); 187. p1 = BN_CTX_get(ctx); 188. q1 = BN_CTX_get(ctx); ^ 189. lcm = BN_CTX_get(ctx); 190. p1q1 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/rsa/rsa_sp800_56b_gen.c:189:11: Call 187. p1 = BN_CTX_get(ctx); 188. q1 = BN_CTX_get(ctx); 189. lcm = BN_CTX_get(ctx); ^ 190. p1q1 = BN_CTX_get(ctx); 191. gcd = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/rsa/rsa_sp800_56b_gen.c:190:12: Call 188. q1 = BN_CTX_get(ctx); 189. lcm = BN_CTX_get(ctx); 190. p1q1 = BN_CTX_get(ctx); ^ 191. gcd = BN_CTX_get(ctx); 192. if (gcd == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/rsa/rsa_sp800_56b_gen.c:191:11: Call 189. lcm = BN_CTX_get(ctx); 190. p1q1 = BN_CTX_get(ctx); 191. gcd = BN_CTX_get(ctx); ^ 192. if (gcd == NULL) 193. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/rsa/rsa_sp800_56b_gen.c:196:9: Call 194. 195. /* LCM((p-1, q-1)) */ 196. if (rsa_get_lcm(ctx, rsa->p, rsa->q, lcm, gcd, p1, q1, p1q1) != 1) ^ 197. goto err; 198. crypto/rsa/rsa_sp800_56b_check.c:220:1: Parameter `ctx->stack.depth` 218. 219. /* return LCM(p-1, q-1) */ 220. > int rsa_get_lcm(BN_CTX *ctx, const BIGNUM *p, const BIGNUM *q, 221. BIGNUM *lcm, BIGNUM *gcd, BIGNUM *p1, BIGNUM *q1, 222. BIGNUM *p1q1) crypto/rsa/rsa_sp800_56b_gen.c:208:27: Call 206. /* (Step 3) d = (e^-1) mod (LCM(p-1, q-1)) */ 207. rsa->d = BN_secure_new(); 208. if (rsa->d == NULL || BN_mod_inverse(rsa->d, e, lcm, ctx) == NULL) ^ 209. goto err; 210. crypto/bn/bn_gcd.c:124:1: Parameter `ctx->stack.depth` 122. BN_CTX *ctx); 123. 124. > BIGNUM *BN_mod_inverse(BIGNUM *in, 125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 126. { crypto/bn/bn_gcd.c:129:10: Call 127. BIGNUM *rv; 128. int noinv; 129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 130. if (noinv) 131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth` 133. } 134. 135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 137. int *pnoinv) crypto/bn/bn_gcd.c:155:16: Call 153. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 154. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 155. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 156. } 157. crypto/bn/bn_gcd.c:458:1: Parameter `ctx->stack.depth` 456. * not contain branches that may leak sensitive information. 457. */ 458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 459. const BIGNUM *a, const BIGNUM *n, 460. BN_CTX *ctx) crypto/bn/bn_gcd.c:469:5: Call 467. bn_check_top(n); 468. 469. BN_CTX_start(ctx); ^ 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gcd.c:470:9: Call 468. 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); ^ 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:471:9: Call 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); ^ 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:472:9: Call 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); ^ 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:473:9: Call 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); ^ 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:474:9: Call 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); ^ 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:475:9: Call 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); ^ 476. T = BN_CTX_get(ctx); 477. if (T == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:476:9: Call 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); ^ 477. if (T == NULL) 478. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:504:18: Call 502. bn_init(&local_B); 503. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 504. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 505. goto err; 506. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:264:1: Parameter `ctx->stack.depth` 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:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_div.c:282:11: Call 280. BN_CTX_start(ctx); 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); ^ 283. snum = BN_CTX_get(ctx); 284. sdiv = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:283:12: Call 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); 283. snum = BN_CTX_get(ctx); ^ 284. sdiv = BN_CTX_get(ctx); 285. if (sdiv == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:284:12: Call 282. tmp = BN_CTX_get(ctx); 283. snum = BN_CTX_get(ctx); 284. sdiv = BN_CTX_get(ctx); ^ 285. if (sdiv == NULL) 286. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.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, 6+max(0, ctx->stack.depth)] - 1):unsigned32 by call to `BN_mod_inverse` 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_42811
static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, BN_CTX *ctx) { unsigned char *buf = NULL; int b, ret = 0, bit, bytes, mask; OPENSSL_CTX *libctx = bn_get_lib_ctx(ctx); if (bits == 0) { if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) goto toosmall; BN_zero(rnd); return 1; } if (bits < 0 || (bits == 1 && top > 0)) goto toosmall; bytes = (bits + 7) / 8; bit = (bits - 1) % 8; mask = 0xff << (bit + 1); buf = OPENSSL_malloc(bytes); if (buf == NULL) { BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); goto err; } b = flag == NORMAL ? rand_bytes_ex(libctx, buf, bytes) : rand_priv_bytes_ex(libctx, buf, bytes); if (b <= 0) goto err; if (flag == TESTING) { int i; unsigned char c; for (i = 0; i < bytes; i++) { if (rand_bytes_ex(libctx, &c, 1) <= 0) goto err; if (c >= 128 && i > 0) buf[i] = buf[i - 1]; else if (c < 42) buf[i] = 0; else if (c < 84) buf[i] = 255; } } if (top >= 0) { if (top) { if (bit == 0) { buf[0] = 1; buf[1] |= 0x80; } else { buf[0] |= (3 << (bit - 1)); } } else { buf[0] |= (1 << bit); } } buf[0] &= ~mask; if (bottom) buf[bytes - 1] |= 1; if (!BN_bin2bn(buf, bytes, rnd)) goto err; ret = 1; err: OPENSSL_clear_free(buf, bytes); bn_check_top(rnd); return ret; toosmall: BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL); return 0; } crypto/bn/bn_gf2m.c:1102: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_solve_quad_arr`. Showing all 16 steps of the trace crypto/bn/bn_gf2m.c:1097:11: Call 1095. if ((arr = OPENSSL_malloc(sizeof(*arr) * max)) == NULL) 1096. goto err; 1097. ret = BN_GF2m_poly2arr(p, arr, max); ^ 1098. if (!ret || ret > max) { 1099. BNerr(BN_F_BN_GF2M_MOD_SOLVE_QUAD, BN_R_INVALID_LENGTH); crypto/bn/bn_gf2m.c:1116:1: Parameter `*p` 1114. * be filled if array was large enough. 1115. */ 1116. > int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max) 1117. { 1118. int i, j, k = 0; crypto/bn/bn_gf2m.c:1102:11: Call 1100. goto err; 1101. } 1102. ret = BN_GF2m_mod_solve_quad_arr(r, a, arr, ctx); ^ 1103. bn_check_top(r); 1104. err: crypto/bn/bn_gf2m.c:983:1: Parameter `*p` 981. * 0. Uses algorithms A.4.7 and A.4.6 from IEEE P1363. 982. */ 983. > int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const int p[], 984. BN_CTX *ctx) 985. { crypto/bn/bn_gf2m.c:1034:18: Call 1032. goto err; 1033. do { 1034. if (!BN_priv_rand(rho, p[0], BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY)) ^ 1035. goto err; 1036. if (!BN_GF2m_mod_arr(rho, rho, p)) crypto/bn/bn_rand.c:121:1: Parameter `bits` 119. } 120. 121. > int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom) 122. { 123. return bnrand(PRIVATE, rnd, bits, top, bottom, NULL); crypto/bn/bn_rand.c:123:12: Call 121. int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom) 122. { 123. return bnrand(PRIVATE, rnd, bits, top, bottom, NULL); ^ 124. } 125. crypto/bn/bn_rand.c:62:14: <Offset trace> 60. unsigned char c; 61. 62. for (i = 0; i < bytes; i++) { ^ 63. if (rand_bytes_ex(libctx, &c, 1) <= 0) 64. goto err; crypto/bn/bn_rand.c:62:14: Assignment 60. unsigned char c; 61. 62. for (i = 0; i < bytes; i++) { ^ 63. if (rand_bytes_ex(libctx, &c, 1) <= 0) 64. goto err; crypto/bn/bn_rand.c:23:1: <Length trace> 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_rand.c:23:1: Parameter `bits` 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_rand.c:39:5: Assignment 37. goto toosmall; 38. 39. bytes = (bits + 7) / 8; ^ 40. bit = (bits - 1) % 8; 41. mask = 0xff << (bit + 1); crypto/bn/bn_rand.c:43:11: Call 41. mask = 0xff << (bit + 1); 42. 43. buf = OPENSSL_malloc(bytes); ^ 44. if (buf == NULL) { 45. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/bn/bn_rand.c:43:5: Assignment 41. mask = 0xff << (bit + 1); 42. 43. buf = OPENSSL_malloc(bytes); ^ 44. if (buf == NULL) { 45. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/bn/bn_rand.c:88:9: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_solve_quad_arr` 86. buf[0] &= ~mask; 87. if (bottom) /* set bottom bit if requested */ 88. buf[bytes - 1] |= 1; ^ 89. if (!BN_bin2bn(buf, bytes, rnd)) 90. goto err;
https://github.com/openssl/openssl/blob/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_rand.c/#L88
d2a_code_trace_data_42812
int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl) { int i, j, bl; if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { i = ctx->cipher->do_cipher(ctx, out, in, inl); if (i < 0) return 0; else *outl = i; return 1; } if (inl <= 0) { *outl = 0; return inl == 0; } if (ctx->buf_len == 0 && (inl & (ctx->block_mask)) == 0) { if (ctx->cipher->do_cipher(ctx, out, in, inl)) { *outl = inl; return 1; } else { *outl = 0; return 0; } } i = ctx->buf_len; bl = ctx->cipher->block_size; OPENSSL_assert(bl <= (int)sizeof(ctx->buf)); if (i != 0) { if (i + inl < bl) { memcpy(&(ctx->buf[i]), in, inl); ctx->buf_len += inl; *outl = 0; return 1; } else { j = bl - i; memcpy(&(ctx->buf[i]), in, j); if (!ctx->cipher->do_cipher(ctx, out, ctx->buf, bl)) return 0; inl -= j; in += j; out += bl; *outl = bl; } } else *outl = 0; i = inl & (bl - 1); inl -= i; if (inl > 0) { if (!ctx->cipher->do_cipher(ctx, out, in, inl)) return 0; *outl += inl; } if (i != 0) memcpy(ctx->buf, &(in[inl]), i); ctx->buf_len = i; return 1; } apps/cms.c:1015: error: BUFFER_OVERRUN_L3 Offset added: [1, +oo] Size: [0, +oo] by call to `CMS_decrypt`. Showing all 25 steps of the trace apps/cms.c:1002:18: Call 1000. /* If not streaming or resigning finalize structure */ 1001. if ((operation == SMIME_SIGN) && !(flags & CMS_STREAM)) { 1002. if (!CMS_final(cms, in, NULL, flags)) ^ 1003. goto end; 1004. } crypto/cms/cms_smime.c:801:1: Parameter `*cms->d.envelopedData->encryptedContentInfo->key` 799. } 800. 801. > int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags) 802. { 803. BIO *cmsbio; crypto/cms/cms_smime.c:806:19: Call 804. int ret = 0; 805. 806. if ((cmsbio = CMS_dataInit(cms, dcont)) == NULL) { ^ 807. CMSerr(CMS_F_CMS_FINAL, CMS_R_CMS_LIB); 808. return 0; crypto/cms/cms_lib.c:101:1: Parameter `*cms->d.envelopedData->encryptedContentInfo->key` 99. } 100. 101. > BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont) 102. { 103. BIO *cmsbio, *cont; apps/cms.c:1015:13: Call 1013. if (operation == SMIME_DECRYPT) { 1014. if (flags & CMS_DEBUG_DECRYPT) 1015. CMS_decrypt(cms, NULL, NULL, NULL, NULL, flags); ^ 1016. 1017. if (secret_key) { crypto/cms/cms_smime.c:774:1: Parameter `*cms->d.envelopedData->encryptedContentInfo->key` 772. } 773. 774. > int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert, 775. BIO *dcont, BIO *out, unsigned int flags) 776. { crypto/cms/cms_smime.c:793:12: Call 791. if (pk && !CMS_decrypt_set1_pkey(cms, pk, cert)) 792. return 0; 793. cont = CMS_dataInit(cms, dcont); ^ 794. if (!cont) 795. return 0; crypto/cms/cms_lib.c:101:1: Parameter `*cms->d.envelopedData->encryptedContentInfo->key` 99. } 100. 101. > BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont) 102. { 103. BIO *cmsbio, *cont; crypto/cms/cms_lib.c:135:18: Call 133. 134. case NID_pkcs7_enveloped: 135. cmsbio = cms_EnvelopedData_init_bio(cms); ^ 136. break; 137. crypto/cms/cms_env.c:897:11: Call 895. 896. ec = cms->d.envelopedData->encryptedContentInfo; 897. ret = cms_EncryptedContent_init_bio(ec); ^ 898. 899. /* If error or no cipher end of processing */ crypto/cms/cms_enc.c:68:1: Parameter `ec->keylen` 66. /* Return BIO based on EncryptedContentInfo and key */ 67. 68. > BIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec) 69. { 70. BIO *b; crypto/cms/cms_env.c:910:13: Call 908. for (i = 0; i < sk_CMS_RecipientInfo_num(rinfos); i++) { 909. ri = sk_CMS_RecipientInfo_value(rinfos, i); 910. if (CMS_RecipientInfo_encrypt(cms, ri) <= 0) { ^ 911. CMSerr(CMS_F_CMS_ENVELOPEDDATA_INIT_BIO, 912. CMS_R_ERROR_SETTING_RECIPIENTINFO); crypto/cms/cms_env.c:801:1: Parameter `*cms->d.envelopedData->encryptedContentInfo->key` 799. } 800. 801. > int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri) 802. { 803. switch (ri->type) { crypto/cms/cms_env.c:808:16: Call 806. 807. case CMS_RECIPINFO_AGREE: 808. return cms_RecipientInfo_kari_encrypt(cms, ri); ^ 809. 810. case CMS_RECIPINFO_KEK: crypto/cms/cms_kari.c:406:1: Parameter `*cms->d.envelopedData->encryptedContentInfo->key` 404. /* Encrypt content key in key agreement recipient info */ 405. 406. > int cms_RecipientInfo_kari_encrypt(CMS_ContentInfo *cms, 407. CMS_RecipientInfo *ri) 408. { crypto/cms/cms_kari.c:446:14: Call 444. if (EVP_PKEY_derive_set_peer(kari->pctx, rek->pkey) <= 0) 445. return 0; 446. if (!cms_kek_cipher(&enckey, &enckeylen, ec->key, ec->keylen, ^ 447. kari, 1)) 448. return 0; crypto/cms/cms_kari.c:232:1: Parameter `inlen` 230. */ 231. 232. > static int cms_kek_cipher(unsigned char **pout, size_t *poutlen, 233. const unsigned char *in, size_t inlen, 234. CMS_KeyAgreeRecipientInfo *kari, int enc) crypto/cms/cms_kari.c:252:10: Call 250. goto err; 251. /* obtain output length of ciphered key */ 252. if (!EVP_CipherUpdate(kari->ctx, NULL, &outlen, in, inlen)) ^ 253. goto err; 254. out = OPENSSL_malloc(outlen); crypto/evp/evp_enc.c:259:1: Parameter `inl` 257. } 258. 259. > int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 260. const unsigned char *in, int inl) 261. { crypto/evp/evp_enc.c:263:16: Call 261. { 262. if (ctx->encrypt) 263. return EVP_EncryptUpdate(ctx, out, outl, in, inl); ^ 264. else 265. return EVP_DecryptUpdate(ctx, out, outl, in, inl); crypto/evp/evp_enc.c:310:1: <Offset trace> 308. } 309. 310. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 311. const unsigned char *in, int inl) 312. { crypto/evp/evp_enc.c:310:1: Parameter `inl` 308. } 309. 310. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 311. const unsigned char *in, int inl) 312. { crypto/evp/evp_enc.c:310:1: <Length trace> 308. } 309. 310. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 311. const unsigned char *in, int inl) 312. { crypto/evp/evp_enc.c:310:1: Parameter `*in` 308. } 309. 310. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 311. const unsigned char *in, int inl) 312. { crypto/evp/evp_enc.c:343:13: Array access: Offset added: [1, +oo] Size: [0, +oo] by call to `CMS_decrypt` 341. if (i != 0) { 342. if (i + inl < bl) { 343. memcpy(&(ctx->buf[i]), in, inl); ^ 344. ctx->buf_len += inl; 345. *outl = 0;
https://github.com/openssl/openssl/blob/846ec07d904f9cc81d486db0db14fb84f61ff6e5/crypto/evp/evp_enc.c/#L343
d2a_code_trace_data_42813
int ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec, size_t md_size) { #if defined(CBC_MAC_ROTATE_IN_PLACE) unsigned char rotated_mac_buf[64 + EVP_MAX_MD_SIZE]; unsigned char *rotated_mac; #else unsigned char rotated_mac[EVP_MAX_MD_SIZE]; #endif size_t mac_end = rec->length; size_t mac_start = mac_end - md_size; size_t in_mac; size_t scan_start = 0; size_t i, j; size_t rotate_offset; if (!ossl_assert(rec->orig_len >= md_size && md_size <= EVP_MAX_MD_SIZE)) return 0; #if defined(CBC_MAC_ROTATE_IN_PLACE) rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) & 63); #endif if (rec->orig_len > md_size + 255 + 1) scan_start = rec->orig_len - (md_size + 255 + 1); in_mac = 0; rotate_offset = 0; memset(rotated_mac, 0, md_size); for (i = scan_start, j = 0; i < rec->orig_len; i++) { size_t mac_started = constant_time_eq_s(i, mac_start); size_t mac_ended = constant_time_lt_s(i, mac_end); unsigned char b = rec->data[i]; in_mac |= mac_started; in_mac &= mac_ended; rotate_offset |= j & mac_started; rotated_mac[j++] |= b & in_mac; j &= constant_time_lt_s(j, md_size); } #if defined(CBC_MAC_ROTATE_IN_PLACE) j = 0; for (i = 0; i < md_size; i++) { ((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32]; out[j++] = rotated_mac[rotate_offset++]; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #else memset(out, 0, md_size); rotate_offset = md_size - rotate_offset; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); for (i = 0; i < md_size; i++) { for (j = 0; j < md_size; j++) out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset); rotate_offset++; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #endif return 1; } ssl/record/ssl3_record.c:1881: error: INTEGER_OVERFLOW_L2 ([0, 17728] - [256, 320]):unsigned64 by call to `dtls1_process_record`. Showing all 11 steps of the trace ssl/record/ssl3_record.c:1769:13: Unknown value from: non-const function 1767. 1768. if (s->msg_callback) 1769. s->msg_callback(0, 0, SSL3_RT_HEADER, p, DTLS1_RT_HEADER_LENGTH, ^ 1770. s, s->msg_callback_arg); 1771. ssl/record/ssl3_record.c:1784:9: Assignment 1782. p += 6; 1783. 1784. n2s(p, rr->length); ^ 1785. 1786. /* Lets check version */ ssl/record/ssl3_record.c:1881:10: Call 1879. } 1880. 1881. if (!dtls1_process_record(s, bitmap)) { ^ 1882. rr->length = 0; 1883. RECORD_LAYER_reset_packet_length(&s->rlayer); /* dump this record */ ssl/record/ssl3_record.c:1495:1: Parameter `s->rlayer.rrec.length` 1493. } 1494. 1495. > int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap) 1496. { 1497. int i, al; ssl/record/ssl3_record.c:1535:5: Assignment 1533. /* decrypt in place in 'rr->input' */ 1534. rr->data = rr->input; 1535. rr->orig_len = rr->length; ^ 1536. 1537. if (SSL_READ_ETM(s) && s->read_hash) { ssl/record/ssl3_record.c:1628:18: Call 1626. */ 1627. mac = mac_tmp; 1628. if (!ssl3_cbc_copy_mac(mac_tmp, rr, mac_size)) { ^ 1629. al = SSL_AD_INTERNAL_ERROR; 1630. SSLerr(SSL_F_DTLS1_PROCESS_RECORD, ERR_R_INTERNAL_ERROR); ssl/record/ssl3_record.c:1420:1: <LHS trace> 1418. #define CBC_MAC_ROTATE_IN_PLACE 1419. 1420. > int ssl3_cbc_copy_mac(unsigned char *out, 1421. const SSL3_RECORD *rec, size_t md_size) 1422. { ssl/record/ssl3_record.c:1420:1: Parameter `md_size` 1418. #define CBC_MAC_ROTATE_IN_PLACE 1419. 1420. > int ssl3_cbc_copy_mac(unsigned char *out, 1421. const SSL3_RECORD *rec, size_t md_size) 1422. { ssl/record/ssl3_record.c:1420:1: <RHS trace> 1418. #define CBC_MAC_ROTATE_IN_PLACE 1419. 1420. > int ssl3_cbc_copy_mac(unsigned char *out, 1421. const SSL3_RECORD *rec, size_t md_size) 1422. { ssl/record/ssl3_record.c:1420:1: Parameter `md_size` 1418. #define CBC_MAC_ROTATE_IN_PLACE 1419. 1420. > int ssl3_cbc_copy_mac(unsigned char *out, 1421. const SSL3_RECORD *rec, size_t md_size) 1422. { ssl/record/ssl3_record.c:1454:9: Binary operation: ([0, 17728] - [256, 320]):unsigned64 by call to `dtls1_process_record` 1452. /* This information is public so it's safe to branch based on it. */ 1453. if (rec->orig_len > md_size + 255 + 1) 1454. scan_start = rec->orig_len - (md_size + 255 + 1); ^ 1455. 1456. in_mac = 0;
https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/ssl/record/ssl3_record.c/#L1454
d2a_code_trace_data_42814
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:311: error: Integer Overflow L2 ([1, +oo] - 6):unsigned32 by call to `bitstream_read`. libavcodec/takdec.c:311:26: Call 309. 310. coding_mode[0] = 311. mode = bitstream_read(bc, 6); ^ 312. 313. for (i = 1; i < wlength; i++) { 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] - 6):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_42815
static void rtmp_calc_digest(const uint8_t *src, int len, int gap, const uint8_t *key, int keylen, uint8_t *dst) { struct AVSHA *sha; uint8_t hmac_buf[64+32] = {0}; int i; sha = av_mallocz(av_sha_size); if (keylen < 64) { memcpy(hmac_buf, key, keylen); } else { av_sha_init(sha, 256); av_sha_update(sha,key, keylen); av_sha_final(sha, hmac_buf); } for (i = 0; i < 64; i++) hmac_buf[i] ^= HMAC_IPAD_VAL; av_sha_init(sha, 256); av_sha_update(sha, hmac_buf, 64); if (gap <= 0) { av_sha_update(sha, src, len); } else { av_sha_update(sha, src, gap); av_sha_update(sha, src + gap + 32, len - gap - 32); } av_sha_final(sha, hmac_buf + 64); for (i = 0; i < 64; i++) hmac_buf[i] ^= HMAC_IPAD_VAL ^ HMAC_OPAD_VAL; av_sha_init(sha, 256); av_sha_update(sha, hmac_buf, 64+32); av_sha_final(sha, dst); av_free(sha); } libavformat/rtmpproto.c:391: error: Null Dereference pointer `sha` last assigned on line 379 could be null and is dereferenced by call to `av_sha_init()` at line 391, column 5. libavformat/rtmpproto.c:372:1: start of procedure rtmp_calc_digest() 370. * @param dst buffer where calculated digest will be stored (32 bytes) 371. */ 372. static void rtmp_calc_digest(const uint8_t *src, int len, int gap, ^ 373. const uint8_t *key, int keylen, uint8_t *dst) 374. { libavformat/rtmpproto.c:376:5: 374. { 375. struct AVSHA *sha; 376. uint8_t hmac_buf[64+32] = {0}; ^ 377. int i; 378. libavformat/rtmpproto.c:379:5: 377. int i; 378. 379. sha = av_mallocz(av_sha_size); ^ 380. 381. if (keylen < 64) { libavutil/mem.c:154:1: start of procedure av_mallocz() 152. } 153. 154. void *av_mallocz(size_t size) ^ 155. { 156. void *ptr = av_malloc(size); libavutil/mem.c:156:5: 154. void *av_mallocz(size_t size) 155. { 156. void *ptr = av_malloc(size); ^ 157. if (ptr) 158. memset(ptr, 0, size); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking true branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:73:9: 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) 73. return NULL; ^ 74. 75. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavutil/mem.c:157:9: Taking false branch 155. { 156. void *ptr = av_malloc(size); 157. if (ptr) ^ 158. memset(ptr, 0, size); 159. return ptr; libavutil/mem.c:159:5: 157. if (ptr) 158. memset(ptr, 0, size); 159. return ptr; ^ 160. } 161. libavutil/mem.c:160:1: return from a call to av_mallocz 158. memset(ptr, 0, size); 159. return ptr; 160. } ^ 161. 162. char *av_strdup(const char *s) libavformat/rtmpproto.c:381:9: Taking true branch 379. sha = av_mallocz(av_sha_size); 380. 381. if (keylen < 64) { ^ 382. memcpy(hmac_buf, key, keylen); 383. } else { libavformat/rtmpproto.c:382:9: 380. 381. if (keylen < 64) { 382. memcpy(hmac_buf, key, keylen); ^ 383. } else { 384. av_sha_init(sha, 256); libavformat/rtmpproto.c:388:10: 386. av_sha_final(sha, hmac_buf); 387. } 388. for (i = 0; i < 64; i++) ^ 389. hmac_buf[i] ^= HMAC_IPAD_VAL; 390. libavformat/rtmpproto.c:388:17: Loop condition is true. Entering loop body 386. av_sha_final(sha, hmac_buf); 387. } 388. for (i = 0; i < 64; i++) ^ 389. hmac_buf[i] ^= HMAC_IPAD_VAL; 390. libavformat/rtmpproto.c:389:9: 387. } 388. for (i = 0; i < 64; i++) 389. hmac_buf[i] ^= HMAC_IPAD_VAL; ^ 390. 391. av_sha_init(sha, 256); libavformat/rtmpproto.c:388:25: 386. av_sha_final(sha, hmac_buf); 387. } 388. for (i = 0; i < 64; i++) ^ 389. hmac_buf[i] ^= HMAC_IPAD_VAL; 390. libavformat/rtmpproto.c:388:17: Loop condition is false. Leaving loop 386. av_sha_final(sha, hmac_buf); 387. } 388. for (i = 0; i < 64; i++) ^ 389. hmac_buf[i] ^= HMAC_IPAD_VAL; 390. libavformat/rtmpproto.c:391:5: 389. hmac_buf[i] ^= HMAC_IPAD_VAL; 390. 391. av_sha_init(sha, 256); ^ 392. av_sha_update(sha, hmac_buf, 64); 393. if (gap <= 0) { libavutil/sha.c:245:1: start of procedure av_sha_init() 243. 244. 245. int av_sha_init(AVSHA* ctx, int bits) ^ 246. { 247. ctx->digest_len = bits >> 5; libavutil/sha.c:247:5: 245. int av_sha_init(AVSHA* ctx, int bits) 246. { 247. ctx->digest_len = bits >> 5; ^ 248. switch (bits) { 249. case 160: // SHA-1
https://github.com/libav/libav/blob/be64629a135642f20325e1422352707bb81d5c91/libavformat/rtmpproto.c/#L391
d2a_code_trace_data_42816
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); } test/servername_test.c:123: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_free`. Showing all 16 steps of the trace test/servername_test.c:94:11: Call 92. goto end; 93. 94. con = SSL_new(ctx); ^ 95. if (!TEST_ptr(con)) 96. goto end; ssl/ssl_lib.c:603:1: Parameter `ctx->sessions->num_items` 601. } 602. 603. > SSL *SSL_new(SSL_CTX *ctx) 604. { 605. SSL *s; test/servername_test.c:123:5: Call 121. end: 122. OPENSSL_free(hostname); 123. SSL_free(con); ^ 124. SSL_CTX_free(ctx); 125. return ret; ssl/ssl_lib.c:1051:1: Parameter `s->session_ctx->sessions->num_items` 1049. } 1050. 1051. > void SSL_free(SSL *s) 1052. { 1053. int i; ssl/ssl_lib.c:1082:9: Call 1080. /* Make the next call work :-) */ 1081. if (s->session != NULL) { 1082. ssl_clear_bad_session(s); ^ 1083. SSL_SESSION_free(s->session); 1084. } ssl/ssl_sess.c:1062:1: Parameter `s->session_ctx->sessions->num_items` 1060. } 1061. 1062. > int ssl_clear_bad_session(SSL *s) 1063. { 1064. if ((s->session != NULL) && ssl/ssl_sess.c:1067:9: Call 1065. !(s->shutdown & SSL_SENT_SHUTDOWN) && 1066. !(SSL_in_init(s) || SSL_in_before(s))) { 1067. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 1068. return (1); 1069. } else ssl/ssl_sess.c:725:1: Parameter `ctx->sessions->num_items` 723. } 724. 725. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 726. { 727. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:727:12: Call 725. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 726. { 727. return remove_session_lock(ctx, c, 1); ^ 728. } 729. ssl/ssl_sess.c:730:1: Parameter `ctx->sessions->num_items` 728. } 729. 730. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 731. { 732. SSL_SESSION *r; ssl/ssl_sess.c:740:17: Call 738. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 739. ret = 1; 740. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 741. SSL_SESSION_list_remove(ctx, c); 742. } ssl/ssl_locl.h:702:1: Parameter `lh->num_items` 700. } TLSEXT_INDEX; 701. 702. > DEFINE_LHASH_OF(SSL_SESSION); 703. /* Needed in ssl_cert.c */ 704. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:702:1: Call 700. } TLSEXT_INDEX; 701. 702. > DEFINE_LHASH_OF(SSL_SESSION); 703. /* Needed in ssl_cert.c */ 704. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:106:1: <LHS trace> 104. } 105. 106. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 107. { 108. unsigned long hash; crypto/lhash/lhash.c:106:1: Parameter `lh->num_items` 104. } 105. 106. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 107. { 108. unsigned long hash; crypto/lhash/lhash.c:126:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free` 124. } 125. 126. lh->num_items--; ^ 127. if ((lh->num_nodes > MIN_NODES) && 128. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/190b9a03b72a8029c27e4bd0ab000129e240a413/crypto/lhash/lhash.c/#L126
d2a_code_trace_data_42817
static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder) { const char *codec_string = encoder ? "encoder" : "decoder"; AVCodec *codec; codec = encoder ? avcodec_find_encoder_by_name(name) : avcodec_find_decoder_by_name(name); if(!codec) { av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name); exit_program(1); } if(codec->type != type) { av_log(NULL, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, name); exit_program(1); } return codec; } avconv.c:2808: error: Null Dereference pointer `codec` last assigned on line 2801 could be null and is dereferenced at line 2808, column 8. avconv.c:2796:1: start of procedure find_codec_or_die() 2794. } 2795. 2796. static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder) ^ 2797. { 2798. const char *codec_string = encoder ? "encoder" : "decoder"; avconv.c:2798:32: Condition is true 2796. static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder) 2797. { 2798. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 2799. AVCodec *codec; 2800. avconv.c:2798:5: 2796. static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder) 2797. { 2798. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 2799. AVCodec *codec; 2800. avconv.c:2801:13: Condition is true 2799. AVCodec *codec; 2800. 2801. codec = encoder ? ^ 2802. avcodec_find_encoder_by_name(name) : 2803. avcodec_find_decoder_by_name(name); avconv.c:2801:5: 2799. AVCodec *codec; 2800. 2801. codec = encoder ? ^ 2802. avcodec_find_encoder_by_name(name) : 2803. avcodec_find_decoder_by_name(name); avconv.c:2804:9: Taking true branch 2802. avcodec_find_encoder_by_name(name) : 2803. avcodec_find_decoder_by_name(name); 2804. if(!codec) { ^ 2805. av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name); 2806. exit_program(1); avconv.c:2805:9: Skipping av_log(): empty list of specs 2803. avcodec_find_decoder_by_name(name); 2804. if(!codec) { 2805. av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name); ^ 2806. exit_program(1); 2807. } avconv.c:2806:9: Skipping exit_program(): empty list of specs 2804. if(!codec) { 2805. av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name); 2806. exit_program(1); ^ 2807. } 2808. if(codec->type != type) { avconv.c:2808:8: 2806. exit_program(1); 2807. } 2808. if(codec->type != type) { ^ 2809. av_log(NULL, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, name); 2810. exit_program(1);
https://github.com/libav/libav/blob/e1edfbcb240cace69d92701e6910c2b03555b7d7/avconv.c/#L2808
d2a_code_trace_data_42818
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:3717: error: Null Dereference pointer `file_oformat` last assigned on line 3706 could be null and is dereferenced at line 3717, column 17. ffmpeg.c:3681:1: start of procedure opt_output_file() 3679. } 3680. 3681. static void opt_output_file(const char *filename) ^ 3682. { 3683. AVFormatContext *oc; ffmpeg.c:3686:5: 3684. int err, use_video, use_audio, use_subtitle; 3685. int input_has_video, input_has_audio, input_has_subtitle; 3686. AVFormatParameters params, *ap = &params; ^ 3687. AVOutputFormat *file_oformat; 3688. ffmpeg.c:3689:10: Taking false branch 3687. AVOutputFormat *file_oformat; 3688. 3689. if (!strcmp(filename, "-")) ^ 3690. filename = "pipe:"; 3691. ffmpeg.c:3692:5: 3690. filename = "pipe:"; 3691. 3692. oc = avformat_alloc_context(); ^ 3693. if (!oc) { 3694. 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 false 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:87:5: Skipping avformat_get_context_defaults(): empty list of specs 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; 89. return ic; libavformat/options.c:88:5: 86. if (!ic) return ic; 87. avformat_get_context_defaults(ic); 88. ic->av_class = &av_format_context_class; ^ 89. return ic; 90. } libavformat/options.c:89:5: 87. avformat_get_context_defaults(ic); 88. ic->av_class = &av_format_context_class; 89. return ic; ^ 90. } 91. 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:3693:10: Taking false branch 3691. 3692. oc = avformat_alloc_context(); 3693. if (!oc) { ^ 3694. print_error(filename, AVERROR(ENOMEM)); 3695. ffmpeg_exit(1); ffmpeg.c:3698:9: Taking false branch 3696. } 3697. 3698. if (last_asked_format) { ^ 3699. file_oformat = av_guess_format(last_asked_format, NULL, NULL); 3700. if (!file_oformat) { ffmpeg.c:3706:9: Skipping av_guess_format(): empty list of specs 3704. last_asked_format = NULL; 3705. } else { 3706. file_oformat = av_guess_format(NULL, filename, NULL); ^ 3707. if (!file_oformat) { 3708. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", ffmpeg.c:3707:14: Taking true branch 3705. } else { 3706. file_oformat = av_guess_format(NULL, filename, NULL); 3707. if (!file_oformat) { ^ 3708. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", 3709. filename); ffmpeg.c:3708:13: 3706. file_oformat = av_guess_format(NULL, filename, NULL); 3707. if (!file_oformat) { 3708. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", ^ 3709. filename); 3710. ffmpeg_exit(1); ffmpeg.c:3710:13: Skipping ffmpeg_exit(): empty list of specs 3708. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", 3709. filename); 3710. ffmpeg_exit(1); ^ 3711. } 3712. } ffmpeg.c:3714:5: 3712. } 3713. 3714. oc->oformat = file_oformat; ^ 3715. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3716. ffmpeg.c:3715:5: 3713. 3714. oc->oformat = file_oformat; 3715. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); ^ 3716. 3717. if (!strcmp(file_oformat->name, "ffm") && libavutil/avstring.c:64:1: start of procedure av_strlcpy() 62. } 63. 64. size_t av_strlcpy(char *dst, const char *src, size_t size) ^ 65. { 66. size_t len = 0; libavutil/avstring.c:66:5: 64. size_t av_strlcpy(char *dst, const char *src, size_t size) 65. { 66. size_t len = 0; ^ 67. while (++len < size && *src) 68. *dst++ = *src++; libavutil/avstring.c:67:12: Loop condition is true. Entering loop body 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:67:28: Loop condition is false. Leaving loop 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:69:9: Taking true branch 67. while (++len < size && *src) 68. *dst++ = *src++; 69. if (len <= size) ^ 70. *dst = 0; 71. return len + strlen(src) - 1; libavutil/avstring.c:70:9: 68. *dst++ = *src++; 69. if (len <= size) 70. *dst = 0; ^ 71. return len + strlen(src) - 1; 72. } libavutil/avstring.c:71:5: 69. if (len <= size) 70. *dst = 0; 71. return len + strlen(src) - 1; ^ 72. } 73. libavutil/avstring.c:72:1: return from a call to av_strlcpy 70. *dst = 0; 71. return len + strlen(src) - 1; 72. } ^ 73. 74. size_t av_strlcat(char *dst, const char *src, size_t size) ffmpeg.c:3717:10: 3715. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3716. 3717. if (!strcmp(file_oformat->name, "ffm") && ^ 3718. av_strstart(filename, "http:", NULL)) { 3719. /* special case for files sent to ffserver: we get the stream
https://github.com/libav/libav/blob/f4c79d1e0b2e797012304db57903e4091b0c2d7c/ffmpeg.c/#L3717
d2a_code_trace_data_42819
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/ecp_smpl.c:852: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_sub_quick`. Showing all 20 steps of the trace crypto/ec/ecp_smpl.c:823:10: Call 821. 822. BN_CTX_start(ctx); 823. n0 = BN_CTX_get(ctx); ^ 824. n1 = BN_CTX_get(ctx); 825. n2 = BN_CTX_get(ctx); 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:366:15: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/bn/bn_lib.c:366:5: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/ec/ecp_smpl.c:852:14: Call 850. if (!BN_mod_add_quick(n0, a->X, n1, p)) 851. goto err; 852. if (!BN_mod_sub_quick(n2, a->X, n1, p)) ^ 853. goto err; 854. if (!field_mul(group, n1, n0, n2, ctx)) crypto/bn/bn_mod.c:116:1: Parameter `*r->d` 114. * less than m 115. */ 116. > int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 117. const BIGNUM *m) 118. { crypto/bn/bn_mod.c:119:10: Call 117. const BIGNUM *m) 118. { 119. if (!BN_sub(r, a, b)) ^ 120. return 0; 121. if (r->neg) crypto/bn/bn_add.c:45:1: Parameter `*r->d` 43. 44. /* signed sub of b from a. */ 45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 46. { 47. int ret, r_neg, cmp_res; crypto/bn/bn_add.c:54:15: Call 52. if (a->neg != b->neg) { 53. r_neg = a->neg; 54. ret = BN_uadd(r, a, b); ^ 55. } else { 56. cmp_res = BN_ucmp(a, b); crypto/bn/bn_add.c:76:1: Parameter `*r->d` 74. 75. /* unsigned add of b to a, r can be equal to a or b. */ 76. > int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 77. { 78. int max, min, dif; crypto/bn/bn_add.c:96:9: Call 94. dif = max - min; 95. 96. if (bn_wexpand(r, max + 1) == NULL) ^ 97. return 0; 98. crypto/bn/bn_lib.c:948:1: Parameter `*a->d` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:950:37: Call 948. BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 951. } 952. 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_mod_sub_quick` 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/4cc968df403ed9321d0df722aba33323ae575ce0/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_42820
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: [209+min(0, `c->synth_buf_offset[*]`), 224+max(511, `c->synth_buf_offset[*]`)] (⇐ [17+min(0, `c->synth_buf_offset[*]`), 32+max(511, `c->synth_buf_offset[*]`)] + 192) 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:908:9: Assignment 906. for(j=1;j<16;j++) { 907. sum2 = 0; 908. p = synth_buf + 16 + j; ^ 909. SUM8P2(sum, +=, sum2, -=, w, w2, p); 910. p = synth_buf + 48 - j; libavcodec/mpegaudiodec.c:909:9: Array access: Offset: [209+min(0, c->synth_buf_offset[*]), 224+max(511, c->synth_buf_offset[*])] (⇐ [17+min(0, c->synth_buf_offset[*]), 32+max(511, c->synth_buf_offset[*])] + 192) Size: 2 by call to `ff_mpa_synth_filter` 907. sum2 = 0; 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);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L909
d2a_code_trace_data_42821
void CRYPTO_free(void *str, const char *file, int line) { if (free_impl != NULL && free_impl != &CRYPTO_free) { free_impl(str, file, line); return; } #ifndef OPENSSL_NO_CRYPTO_MDEBUG if (call_malloc_debug) { CRYPTO_mem_debug_free(str, 0, file, line); free(str); CRYPTO_mem_debug_free(str, 1, file, line); } else { free(str); } #else free(str); #endif } crypto/async/async.c:293: error: USE_AFTER_FREE call to `async_job_free()` eventually accesses memory that was invalidated by call to `free()` on line 293 indirectly during the call to `async_job_free()`. Showing all 40 steps of the trace crypto/async/async.c:284:1: invalidation part of the trace starts here 282. } 283. 284. > static void async_empty_pool(async_pool *pool) 285. { 286. ASYNC_JOB *job; crypto/async/async.c:284:1: parameter `pool` of async_empty_pool 282. } 283. 284. > static void async_empty_pool(async_pool *pool) 285. { 286. ASYNC_JOB *job; crypto/async/async.c:292:15: passed as argument to `sk_ASYNC_JOB_pop` 290. 291. do { 292. job = sk_ASYNC_JOB_pop(pool->jobs); ^ 293. async_job_free(job); 294. } while (job); crypto/async/async_locl.h:64:1: parameter `sk` of sk_ASYNC_JOB_pop 62. }; 63. 64. > DEFINE_STACK_OF(ASYNC_JOB) 65. 66. struct async_pool_st { crypto/async/async_locl.h:64:1: passed as argument to `OPENSSL_sk_pop` 62. }; 63. 64. > DEFINE_STACK_OF(ASYNC_JOB) 65. 66. struct async_pool_st { crypto/stack/stack.c:328:1: parameter `st` of OPENSSL_sk_pop 326. } 327. 328. > void *OPENSSL_sk_pop(OPENSSL_STACK *st) 329. { 330. if (st == NULL) crypto/stack/stack.c:334:12: passed as argument to `internal_delete` 332. if (st->num <= 0) 333. return NULL; 334. return internal_delete(st, st->num - 1); ^ 335. } 336. crypto/stack/stack.c:247:10: passed as argument to function `memmove` with no summary 245. 246. if (loc != st->num - 1) 247. memmove(&st->data[loc], &st->data[loc + 1], ^ 248. sizeof(st->data[0]) * (st->num - loc - 1)); 249. st->num--; crypto/stack/stack.c:247:10: return from call to function `memmove` with no summary 245. 246. if (loc != st->num - 1) 247. memmove(&st->data[loc], &st->data[loc + 1], ^ 248. sizeof(st->data[0]) * (st->num - loc - 1)); 249. st->num--; crypto/stack/stack.c:334:12: return from call to `internal_delete` 332. if (st->num <= 0) 333. return NULL; 334. return internal_delete(st, st->num - 1); ^ 335. } 336. crypto/async/async_locl.h:64:1: return from call to `OPENSSL_sk_pop` 62. }; 63. 64. > DEFINE_STACK_OF(ASYNC_JOB) 65. 66. struct async_pool_st { crypto/async/async.c:292:15: return from call to `sk_ASYNC_JOB_pop` 290. 291. do { 292. job = sk_ASYNC_JOB_pop(pool->jobs); ^ 293. async_job_free(job); 294. } while (job); crypto/async/async.c:292:15: passed as argument to `sk_ASYNC_JOB_pop` 290. 291. do { 292. job = sk_ASYNC_JOB_pop(pool->jobs); ^ 293. async_job_free(job); 294. } while (job); crypto/async/async.c:292:15: return from call to `sk_ASYNC_JOB_pop` 290. 291. do { 292. job = sk_ASYNC_JOB_pop(pool->jobs); ^ 293. async_job_free(job); 294. } while (job); crypto/async/async.c:292:9: assigned 290. 291. do { 292. job = sk_ASYNC_JOB_pop(pool->jobs); ^ 293. async_job_free(job); 294. } while (job); crypto/async/async.c:293:9: when calling `async_job_free` here 291. do { 292. job = sk_ASYNC_JOB_pop(pool->jobs); 293. async_job_free(job); ^ 294. } while (job); 295. } crypto/async/async.c:95:1: parameter `job` of async_job_free 93. } 94. 95. > static void async_job_free(ASYNC_JOB *job) 96. { 97. if (job != NULL) { crypto/async/async.c:100:9: when calling `CRYPTO_free` here 98. OPENSSL_free(job->funcargs); 99. async_fibre_free(&job->fibrectx); 100. OPENSSL_free(job); ^ 101. } 102. } crypto/mem.c:265:1: parameter `str` of CRYPTO_free 263. } 264. 265. > void CRYPTO_free(void *str, const char *file, int line) 266. { 267. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:281:5: was invalidated by call to `free()` 279. } 280. #else 281. free(str); ^ 282. #endif 283. } crypto/async/async.c:284:1: use-after-lifetime part of the trace starts here 282. } 283. 284. > static void async_empty_pool(async_pool *pool) 285. { 286. ASYNC_JOB *job; crypto/async/async.c:284:1: parameter `pool` of async_empty_pool 282. } 283. 284. > static void async_empty_pool(async_pool *pool) 285. { 286. ASYNC_JOB *job; crypto/async/async.c:292:15: passed as argument to `sk_ASYNC_JOB_pop` 290. 291. do { 292. job = sk_ASYNC_JOB_pop(pool->jobs); ^ 293. async_job_free(job); 294. } while (job); crypto/async/async_locl.h:64:1: parameter `sk` of sk_ASYNC_JOB_pop 62. }; 63. 64. > DEFINE_STACK_OF(ASYNC_JOB) 65. 66. struct async_pool_st { crypto/async/async_locl.h:64:1: passed as argument to `OPENSSL_sk_pop` 62. }; 63. 64. > DEFINE_STACK_OF(ASYNC_JOB) 65. 66. struct async_pool_st { crypto/stack/stack.c:328:1: parameter `st` of OPENSSL_sk_pop 326. } 327. 328. > void *OPENSSL_sk_pop(OPENSSL_STACK *st) 329. { 330. if (st == NULL) crypto/stack/stack.c:334:12: passed as argument to `internal_delete` 332. if (st->num <= 0) 333. return NULL; 334. return internal_delete(st, st->num - 1); ^ 335. } 336. crypto/stack/stack.c:247:10: passed as argument to function `memmove` with no summary 245. 246. if (loc != st->num - 1) 247. memmove(&st->data[loc], &st->data[loc + 1], ^ 248. sizeof(st->data[0]) * (st->num - loc - 1)); 249. st->num--; crypto/stack/stack.c:247:10: return from call to function `memmove` with no summary 245. 246. if (loc != st->num - 1) 247. memmove(&st->data[loc], &st->data[loc + 1], ^ 248. sizeof(st->data[0]) * (st->num - loc - 1)); 249. st->num--; crypto/stack/stack.c:334:12: return from call to `internal_delete` 332. if (st->num <= 0) 333. return NULL; 334. return internal_delete(st, st->num - 1); ^ 335. } 336. crypto/async/async_locl.h:64:1: return from call to `OPENSSL_sk_pop` 62. }; 63. 64. > DEFINE_STACK_OF(ASYNC_JOB) 65. 66. struct async_pool_st { crypto/async/async.c:292:15: return from call to `sk_ASYNC_JOB_pop` 290. 291. do { 292. job = sk_ASYNC_JOB_pop(pool->jobs); ^ 293. async_job_free(job); 294. } while (job); crypto/async/async.c:292:15: passed as argument to `sk_ASYNC_JOB_pop` 290. 291. do { 292. job = sk_ASYNC_JOB_pop(pool->jobs); ^ 293. async_job_free(job); 294. } while (job); crypto/async/async.c:292:15: return from call to `sk_ASYNC_JOB_pop` 290. 291. do { 292. job = sk_ASYNC_JOB_pop(pool->jobs); ^ 293. async_job_free(job); 294. } while (job); crypto/async/async.c:292:9: assigned 290. 291. do { 292. job = sk_ASYNC_JOB_pop(pool->jobs); ^ 293. async_job_free(job); 294. } while (job); crypto/async/async.c:293:9: when calling `async_job_free` here 291. do { 292. job = sk_ASYNC_JOB_pop(pool->jobs); 293. async_job_free(job); ^ 294. } while (job); 295. } crypto/async/async.c:95:1: parameter `job` of async_job_free 93. } 94. 95. > static void async_job_free(ASYNC_JOB *job) 96. { 97. if (job != NULL) { crypto/async/async.c:100:9: when calling `CRYPTO_free` here 98. OPENSSL_free(job->funcargs); 99. async_fibre_free(&job->fibrectx); 100. OPENSSL_free(job); ^ 101. } 102. } crypto/mem.c:265:1: parameter `str` of CRYPTO_free 263. } 264. 265. > void CRYPTO_free(void *str, const char *file, int line) 266. { 267. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:281:5: invalid access occurs here 279. } 280. #else 281. free(str); ^ 282. #endif 283. }
https://github.com/openssl/openssl/blob/270a4bba49849de7f928f4fab186205abd132411/crypto/mem.c/#L281
d2a_code_trace_data_42822
void MPV_common_end(MpegEncContext *s) { int i, j, k; for(i=0; i<s->avctx->thread_count; i++){ free_duplicate_context(s->thread_context[i]); } for(i=1; i<s->avctx->thread_count; i++){ av_freep(&s->thread_context[i]); } av_freep(&s->parse_context.buffer); s->parse_context.buffer_size=0; av_freep(&s->mb_type); av_freep(&s->p_mv_table_base); av_freep(&s->b_forw_mv_table_base); av_freep(&s->b_back_mv_table_base); av_freep(&s->b_bidir_forw_mv_table_base); av_freep(&s->b_bidir_back_mv_table_base); av_freep(&s->b_direct_mv_table_base); s->p_mv_table= NULL; s->b_forw_mv_table= NULL; s->b_back_mv_table= NULL; s->b_bidir_forw_mv_table= NULL; s->b_bidir_back_mv_table= NULL; s->b_direct_mv_table= NULL; for(i=0; i<2; i++){ for(j=0; j<2; j++){ for(k=0; k<2; k++){ av_freep(&s->b_field_mv_table_base[i][j][k]); s->b_field_mv_table[i][j][k]=NULL; } av_freep(&s->b_field_select_table[i][j]); av_freep(&s->p_field_mv_table_base[i][j]); s->p_field_mv_table[i][j]=NULL; } av_freep(&s->p_field_select_table[i]); } av_freep(&s->dc_val_base); av_freep(&s->ac_val_base); av_freep(&s->coded_block_base); av_freep(&s->mbintra_table); av_freep(&s->cbp_table); av_freep(&s->pred_dir_table); av_freep(&s->mbskip_table); av_freep(&s->prev_pict_types); av_freep(&s->bitstream_buffer); s->allocated_bitstream_buffer_size=0; av_freep(&s->avctx->stats_out); av_freep(&s->ac_stats); av_freep(&s->error_status_table); av_freep(&s->mb_index2xy); av_freep(&s->lambda_table); av_freep(&s->q_intra_matrix); av_freep(&s->q_inter_matrix); av_freep(&s->q_intra_matrix16); av_freep(&s->q_inter_matrix16); av_freep(&s->input_picture); av_freep(&s->reordered_input_picture); av_freep(&s->dct_offset); if(s->picture){ for(i=0; i<MAX_PICTURE_COUNT; i++){ free_picture(s, &s->picture[i]); } } av_freep(&s->picture); s->context_initialized = 0; s->last_picture_ptr= s->next_picture_ptr= s->current_picture_ptr= NULL; s->linesize= s->uvlinesize= 0; for(i=0; i<3; i++) av_freep(&s->visualization_buffer[i]); avcodec_default_free_buffers(s->avctx); } libavcodec/h261dec.c:585: error: Buffer Overrun L2 Offset: [0, 1000] Size: 8 by call to `MPV_common_end`. libavcodec/h261dec.c:574:11: Call 572. } 573. 574. ret = h261_decode_picture_header(h); ^ 575. 576. /* skip if the header was thrashed */ libavcodec/h261dec.c:462:38: Assignment 460. s->picture_number = (s->picture_number&~31) + i; 461. 462. s->avctx->time_base= (AVRational){1001, 30000}; ^ 463. s->current_picture.pts= s->picture_number; 464. libavcodec/h261dec.c:585:9: Call 583. ParseContext pc= s->parse_context; //FIXME move this demuxing hack to libavformat 584. s->parse_context.buffer=0; 585. MPV_common_end(s); ^ 586. s->parse_context= pc; 587. } libavcodec/mpegvideo.c:591:1: <Offset trace> 589. 590. /* init common structure for both encoder and decoder */ 591. void MPV_common_end(MpegEncContext *s) ^ 592. { 593. int i, j, k; libavcodec/mpegvideo.c:591:1: Parameter `s->avctx->thread_count` 589. 590. /* init common structure for both encoder and decoder */ 591. void MPV_common_end(MpegEncContext *s) ^ 592. { 593. int i, j, k; libavcodec/mpegvideo.c:591:1: <Length trace> 589. 590. /* init common structure for both encoder and decoder */ 591. void MPV_common_end(MpegEncContext *s) ^ 592. { 593. int i, j, k; libavcodec/mpegvideo.c:591:1: Parameter `s->thread_context[*]` 589. 590. /* init common structure for both encoder and decoder */ 591. void MPV_common_end(MpegEncContext *s) ^ 592. { 593. int i, j, k; libavcodec/mpegvideo.c:596:32: Array access: Offset: [0, 1000] Size: 8 by call to `MPV_common_end` 594. 595. for(i=0; i<s->avctx->thread_count; i++){ 596. free_duplicate_context(s->thread_context[i]); ^ 597. } 598. for(i=1; i<s->avctx->thread_count; i++){
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo.c/#L596
d2a_code_trace_data_42823
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } test/srptest.c:180: error: BUFFER_OVERRUN_L3 Offset: [31, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN`. Showing all 23 steps of the trace test/srptest.c:180:10: Call 178. BN_hex2bn(&s, "BEB25379D1A8581EB5A727673A2441EE"); 179. /* Set up server's password entry */ 180. if (!SRP_create_verifier_BN("alice", "password123", &s, &v, GN->N, ^ 181. GN->g)) { 182. fprintf(stderr, "Failed to create SRP verifier\n"); crypto/srp/srp_vfy.c:630:1: Parameter `g->top` 628. * BIGNUMS. 629. */ 630. > int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, 631. BIGNUM **verifier, const BIGNUM *N, 632. const BIGNUM *g) crypto/srp/srp_vfy.c:661:10: Call 659. goto err; 660. 661. if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) { ^ 662. BN_clear_free(*verifier); 663. goto err; crypto/bn/bn_exp.c:90:1: Parameter `a->top` 88. } 89. 90. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 91. BN_CTX *ctx) 92. { crypto/bn/bn_exp.c:150:19: Call 148. } else 149. # endif 150. ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL); ^ 151. } else 152. #endif crypto/bn/bn_exp.c:300:1: Parameter `a->top` 298. } 299. 300. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 301. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 302. { crypto/bn/bn_exp.c:312:16: Call 310. 311. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 312. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 313. } 314. crypto/bn/bn_exp.c:600:1: Parameter `a->top` 598. * http://www.daemonology.net/hyperthreading-considered-harmful/) 599. */ 600. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 601. const BIGNUM *m, BN_CTX *ctx, 602. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:757:17: Call 755. if (!BN_to_montgomery(&am, &am, mont, ctx)) 756. goto err; 757. } else if (!BN_to_montgomery(&am, a, mont, ctx)) ^ 758. goto err; 759. crypto/bn/bn_lib.c:945:1: Parameter `a->top` 943. } 944. 945. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 946. BN_CTX *ctx) 947. { crypto/bn/bn_lib.c:948:12: Call 946. BN_CTX *ctx) 947. { 948. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx); ^ 949. } 950. crypto/bn/bn_mont.c:26:1: Parameter `a->top` 24. #endif 25. 26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { crypto/bn/bn_mont.c:53:14: Call 51. bn_check_top(tmp); 52. if (a == b) { 53. if (!BN_sqr(tmp, a, ctx)) ^ 54. goto err; 55. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:104:1: <Offset trace> 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:104:1: Parameter `n` 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:110:5: Assignment 108. BN_ULONG *rp; 109. 110. max = n * 2; ^ 111. ap = a; 112. rp = r; crypto/bn/bn_sqr.c:104:1: <Length trace> 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:104:1: Parameter `*r` 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:112:5: Assignment 110. max = n * 2; 111. ap = a; 112. rp = r; ^ 113. rp[0] = rp[max - 1] = 0; 114. rp++; crypto/bn/bn_sqr.c:113:13: Array access: Offset: [31, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN` 111. ap = a; 112. rp = r; 113. rp[0] = rp[max - 1] = 0; ^ 114. rp++; 115. j = n;
https://github.com/openssl/openssl/blob/b90506e995d44dee0ef4dd0324b56b59154256c2/crypto/bn/bn_sqr.c/#L113
d2a_code_trace_data_42824
static int decode_subframe(WMAProDecodeCtx *s) { int offset = s->samples_per_frame; int subframe_len = s->samples_per_frame; int i; int total_samples = s->samples_per_frame * s->num_channels; int transmit_coeffs = 0; int cur_subwoofer_cutoff; s->subframe_offset = get_bits_count(&s->gb); for (i = 0; i < s->num_channels; i++) { s->channel[i].grouped = 0; if (offset > s->channel[i].decoded_samples) { offset = s->channel[i].decoded_samples; subframe_len = s->channel[i].subframe_len[s->channel[i].cur_subframe]; } } av_dlog(s->avctx, "processing subframe with offset %i len %i\n", offset, subframe_len); s->channels_for_cur_subframe = 0; for (i = 0; i < s->num_channels; i++) { const int cur_subframe = s->channel[i].cur_subframe; total_samples -= s->channel[i].decoded_samples; if (offset == s->channel[i].decoded_samples && subframe_len == s->channel[i].subframe_len[cur_subframe]) { total_samples -= s->channel[i].subframe_len[cur_subframe]; s->channel[i].decoded_samples += s->channel[i].subframe_len[cur_subframe]; s->channel_indexes_for_cur_subframe[s->channels_for_cur_subframe] = i; ++s->channels_for_cur_subframe; } } if (!total_samples) s->parsed_all_subframes = 1; av_dlog(s->avctx, "subframe is part of %i channels\n", s->channels_for_cur_subframe); s->table_idx = av_log2(s->samples_per_frame/subframe_len); s->num_bands = s->num_sfb[s->table_idx]; s->cur_sfb_offsets = s->sfb_offsets[s->table_idx]; cur_subwoofer_cutoff = s->subwoofer_cutoffs[s->table_idx]; for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; s->channel[c].coeffs = &s->channel[c].out[(s->samples_per_frame >> 1) + offset]; } s->subframe_len = subframe_len; s->esc_len = av_log2(s->subframe_len - 1) + 1; if (get_bits1(&s->gb)) { int num_fill_bits; if (!(num_fill_bits = get_bits(&s->gb, 2))) { int len = get_bits(&s->gb, 4); num_fill_bits = get_bits(&s->gb, len) + 1; } if (num_fill_bits >= 0) { if (get_bits_count(&s->gb) + num_fill_bits > s->num_saved_bits) { av_log(s->avctx, AV_LOG_ERROR, "invalid number of fill bits\n"); return AVERROR_INVALIDDATA; } skip_bits_long(&s->gb, num_fill_bits); } } if (get_bits1(&s->gb)) { av_log_ask_for_sample(s->avctx, "reserved bit set\n"); return AVERROR_INVALIDDATA; } if (decode_channel_transform(s) < 0) return AVERROR_INVALIDDATA; for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; if ((s->channel[c].transmit_coefs = get_bits1(&s->gb))) transmit_coeffs = 1; } if (transmit_coeffs) { int step; int quant_step = 90 * s->bits_per_sample >> 4; if ((s->transmit_num_vec_coeffs = get_bits1(&s->gb))) { int num_bits = av_log2((s->subframe_len + 3)/4) + 1; for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; s->channel[c].num_vec_coeffs = get_bits(&s->gb, num_bits) << 2; } } else { for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; s->channel[c].num_vec_coeffs = s->subframe_len; } } step = get_sbits(&s->gb, 6); quant_step += step; if (step == -32 || step == 31) { const int sign = (step == 31) - 1; int quant = 0; while (get_bits_count(&s->gb) + 5 < s->num_saved_bits && (step = get_bits(&s->gb, 5)) == 31) { quant += 31; } quant_step += ((quant + step) ^ sign) - sign; } if (quant_step < 0) { av_log(s->avctx, AV_LOG_DEBUG, "negative quant step\n"); } if (s->channels_for_cur_subframe == 1) { s->channel[s->channel_indexes_for_cur_subframe[0]].quant_step = quant_step; } else { int modifier_len = get_bits(&s->gb, 3); for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; s->channel[c].quant_step = quant_step; if (get_bits1(&s->gb)) { if (modifier_len) { s->channel[c].quant_step += get_bits(&s->gb, modifier_len) + 1; } else ++s->channel[c].quant_step; } } } if (decode_scale_factors(s) < 0) return AVERROR_INVALIDDATA; } av_dlog(s->avctx, "BITSTREAM: subframe header length was %i\n", get_bits_count(&s->gb) - s->subframe_offset); for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; if (s->channel[c].transmit_coefs && get_bits_count(&s->gb) < s->num_saved_bits) { decode_coeffs(s, c); } else memset(s->channel[c].coeffs, 0, sizeof(*s->channel[c].coeffs) * subframe_len); } av_dlog(s->avctx, "BITSTREAM: subframe length was %i\n", get_bits_count(&s->gb) - s->subframe_offset); if (transmit_coeffs) { FFTContext *mdct = &s->mdct_ctx[av_log2(subframe_len) - WMAPRO_BLOCK_MIN_BITS]; inverse_channel_transform(s); for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; const int* sf = s->channel[c].scale_factors; int b; if (c == s->lfe_channel) memset(&s->tmp[cur_subwoofer_cutoff], 0, sizeof(*s->tmp) * (subframe_len - cur_subwoofer_cutoff)); for (b = 0; b < s->num_bands; b++) { const int end = FFMIN(s->cur_sfb_offsets[b+1], s->subframe_len); const int exp = s->channel[c].quant_step - (s->channel[c].max_scale_factor - *sf++) * s->channel[c].scale_factor_step; const float quant = pow(10.0, exp / 20.0); int start = s->cur_sfb_offsets[b]; s->dsp.vector_fmul_scalar(s->tmp + start, s->channel[c].coeffs + start, quant, end - start); } mdct->imdct_half(mdct, s->channel[c].coeffs, s->tmp); } } wmapro_window(s); for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; if (s->channel[c].cur_subframe >= s->channel[c].num_subframes) { av_log(s->avctx, AV_LOG_ERROR, "broken subframe\n"); return AVERROR_INVALIDDATA; } ++s->channel[c].cur_subframe; } return 0; } libavcodec/wmaprodec.c:1234: error: Buffer Overrun L3 Offset: [-6, +oo] Size: 7. libavcodec/wmaprodec.c:1234:41: <Offset trace> 1232. 1233. if (transmit_coeffs) { 1234. FFTContext *mdct = &s->mdct_ctx[av_log2(subframe_len) - WMAPRO_BLOCK_MIN_BITS]; ^ 1235. /** reconstruct the per channel data */ 1236. inverse_channel_transform(s); libavcodec/wmaprodec.c:1234:41: Call 1232. 1233. if (transmit_coeffs) { 1234. FFTContext *mdct = &s->mdct_ctx[av_log2(subframe_len) - WMAPRO_BLOCK_MIN_BITS]; ^ 1235. /** reconstruct the per channel data */ 1236. inverse_channel_transform(s); libavutil/common.h:67:1: Global `ff_log2_tab` 65. extern const uint8_t av_reverse[256]; 66. 67. static av_always_inline av_const int av_log2_c(unsigned int v) ^ 68. { 69. int n = 0; libavutil/common.h:78:5: Assignment 76. n += 8; 77. } 78. n += ff_log2_tab[v]; ^ 79. 80. return n; libavutil/common.h:80:5: Assignment 78. n += ff_log2_tab[v]; 79. 80. return n; ^ 81. } 82. libavcodec/wmaprodec.c:1054:1: <Length trace> 1052. *@return 0 on success, < 0 when decoding failed 1053. */ 1054. static int decode_subframe(WMAProDecodeCtx *s) ^ 1055. { 1056. int offset = s->samples_per_frame; libavcodec/wmaprodec.c:1054:1: Parameter `s->mdct_ctx[*]` 1052. *@return 0 on success, < 0 when decoding failed 1053. */ 1054. static int decode_subframe(WMAProDecodeCtx *s) ^ 1055. { 1056. int offset = s->samples_per_frame; libavcodec/wmaprodec.c:1234:9: Array access: Offset: [-6, +oo] Size: 7 1232. 1233. if (transmit_coeffs) { 1234. FFTContext *mdct = &s->mdct_ctx[av_log2(subframe_len) - WMAPRO_BLOCK_MIN_BITS]; ^ 1235. /** reconstruct the per channel data */ 1236. inverse_channel_transform(s);
https://github.com/libav/libav/blob/204cb29b3c84a74cbcd059d353c70c8bdc567d98/libavcodec/wmaprodec.c/#L1234
d2a_code_trace_data_42825
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } crypto/bn/bn_x931p.c:33: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex`. Showing all 51 steps of the trace crypto/bn/bn_x931p.c:25:10: Call 23. { 24. int i = 0, is_prime; 25. if (!BN_copy(pi, Xpi)) ^ 26. return 0; 27. if (!BN_is_odd(pi) && !BN_add_word(pi, 1)) crypto/bn/bn_lib.c:285:1: Parameter `a->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_x931p.c:27:10: Call 25. if (!BN_copy(pi, Xpi)) 26. return 0; 27. if (!BN_is_odd(pi) && !BN_add_word(pi, 1)) ^ 28. return 0; 29. for (;;) { crypto/bn/bn_lib.c:860:1: Parameter `a->top` 858. } 859. 860. > int BN_is_odd(const BIGNUM *a) 861. { 862. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_x931p.c:33:20: Call 31. BN_GENCB_call(cb, 0, i); 32. /* NB 27 MR is specified in X9.31 */ 33. is_prime = BN_is_prime_fasttest_ex(pi, 27, ctx, 1, cb); ^ 34. if (is_prime < 0) 35. return 0; crypto/bn/bn_prime.c:151:1: Parameter `a->top` 149. } 150. 151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 152. int do_trial_division, BN_GENCB *cb) 153. { crypto/bn/bn_prime.c:161:9: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_prime.c:161:29: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_prime.c:165:10: Call 163. 164. /* Check odd and bigger than 1 */ 165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0) ^ 166. return 0; 167. crypto/bn/bn_lib.c:860:1: Parameter `a->top` 858. } 859. 860. > int BN_is_odd(const BIGNUM *a) 861. { 862. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_prime.c:165:26: Call 163. 164. /* Check odd and bigger than 1 */ 165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0) ^ 166. return 0; 167. crypto/bn/bn_lib.c:542:1: Parameter `a->top` 540. } 541. 542. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 543. { 544. int i; crypto/bn/bn_prime.c:198:10: Call 196. 197. /* compute A1 := a - 1 */ 198. if (!BN_copy(A1, a) || !BN_sub_word(A1, 1)) ^ 199. goto err; 200. /* compute A3 := a - 3 */ crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:201:10: Call 199. goto err; 200. /* compute A3 := a - 3 */ 201. if (!BN_copy(A3, a) || !BN_sub_word(A3, 3)) ^ 202. goto err; 203. crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:215:10: Call 213. if (mont == NULL) 214. goto err; 215. if (!BN_MONT_CTX_set(mont, a, ctx)) ^ 216. goto err; 217. crypto/bn/bn_mont.c:238:9: Call 236. BIGNUM *Ri, *R; 237. 238. if (BN_is_zero(mod)) ^ 239. return 0; 240. crypto/bn/bn_lib.c:845:1: Parameter `a->top` 843. } 844. 845. > int BN_is_zero(const BIGNUM *a) 846. { 847. return a->top == 0; crypto/bn/bn_prime.c:223:13: Call 221. goto err; 222. 223. j = witness(check, a, A1, A1_odd, k, ctx, mont); ^ 224. if (j == -1) 225. goto err; crypto/bn/bn_prime.c:245:1: Parameter `a->top` 243. } 244. 245. > static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, 246. const BIGNUM *a1_odd, int k, BN_CTX *ctx, 247. BN_MONT_CTX *mont) crypto/bn/bn_prime.c:249:10: Call 247. BN_MONT_CTX *mont) 248. { 249. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */ ^ 250. return -1; 251. if (BN_is_one(w)) crypto/bn/bn_exp.c:296:1: Parameter `m->top` 294. } 295. 296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 298. { crypto/bn/bn_exp.c:310:16: Call 308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { 310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 311. } 312. crypto/bn/bn_exp.c:745:14: Assignment 743. /* 2^(top*BN_BITS2) - m */ 744. tmp.d[0] = (0 - m->d[0]) & BN_MASK2; 745. for (i = 1; i < top; i++) ^ 746. tmp.d[i] = (~m->d[i]) & BN_MASK2; 747. tmp.top = top; crypto/bn/bn_exp.c:1062:14: Call 1060. bits -= window0; 1061. wvalue = bn_get_bits(p, bits) & wmask; 1062. if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue, ^ 1063. window)) 1064. goto err; crypto/bn/bn_exp.c:520:1: Parameter `top` 518. } 519. 520. > static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top, 521. unsigned char *buf, int idx, 522. int window) crypto/bn/bn_exp.c:577:5: Assignment 575. } 576. 577. b->top = top; ^ 578. bn_correct_top(b); 579. return 1; crypto/bn/bn_exp.c:578:5: Call 576. 577. b->top = top; 578. bn_correct_top(b); ^ 579. return 1; 580. } crypto/bn/bn_lib.c:946:1: Parameter `a->top` 944. } 945. 946. > void bn_correct_top(BIGNUM *a) 947. { 948. BN_ULONG *ftl; crypto/bn/bn_exp.c:1075:22: Call 1073. /* Square the result window-size times */ 1074. for (i = 0; i < window; i++) 1075. if (!BN_mod_mul_montgomery(&tmp, &tmp, &tmp, mont, ctx)) ^ 1076. goto err; 1077. crypto/bn/bn_mont.c:26:1: Parameter `a->top` 24. #endif 25. 26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { crypto/bn/bn_mont.c:53:14: Call 51. bn_check_top(tmp); 52. if (a == b) { 53. if (!BN_sqr(tmp, a, ctx)) ^ 54. goto err; 55. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:105:1: <Offset trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `n` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:116:5: Assignment 114. rp[0] = rp[max - 1] = 0; 115. rp++; 116. j = n; ^ 117. 118. if (--j > 0) { crypto/bn/bn_sqr.c:118:9: Assignment 116. j = n; 117. 118. if (--j > 0) { ^ 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:105:1: <Length trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `*r` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:113:5: Assignment 111. max = n * 2; 112. ap = a; 113. rp = r; ^ 114. rp[0] = rp[max - 1] = 0; 115. rp++; crypto/bn/bn_sqr.c:115:5: Assignment 113. rp = r; 114. rp[0] = rp[max - 1] = 0; 115. rp++; ^ 116. j = n; 117. crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex` 118. if (--j > 0) { 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 121. rp += 2; 122. }
https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_sqr.c/#L120
d2a_code_trace_data_42826
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) { bn_check_top(b); if (a == b) return a; if (bn_wexpand(a, b->top) == NULL) return NULL; if (b->top > 0) memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); a->neg = b->neg; a->top = b->top; a->flags |= b->flags & BN_FLG_FIXED_TOP; bn_check_top(a); return a; } test/sm2_internal_test.c:167: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_POINT_mul`. Showing all 19 steps of the trace test/sm2_internal_test.c:156:17: Call 154. 155. if (!TEST_ptr(expected) 156. || !TEST_true(BN_hex2bn(&priv, privkey_hex))) ^ 157. goto done; 158. crypto/bn/bn_print.c:166:5: Assignment 164. j = i; /* least significant 'hex' */ 165. m = 0; 166. h = 0; ^ 167. while (j > 0) { 168. m = (BN_BYTES * 2 <= j) ? BN_BYTES * 2 : j; crypto/bn/bn_print.c:184:5: Assignment 182. j -= BN_BYTES * 2; 183. } 184. ret->top = h; ^ 185. bn_correct_top(ret); 186. test/sm2_internal_test.c:167:17: Call 165. pt = EC_POINT_new(group); 166. if (!TEST_ptr(pt) 167. || !TEST_true(EC_POINT_mul(group, pt, priv, NULL, NULL, NULL)) ^ 168. || !TEST_true(EC_KEY_set_public_key(key, pt)) 169. || !TEST_true(sm2_ciphertext_size(key, digest, msg_len, &ctext_len))) crypto/ec/ec_lib.c:971:1: Parameter `g_scalar->top` 969. } 970. 971. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, 972. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) 973. { crypto/ec/ec_lib.c:982:12: Call 980. scalars[0] = p_scalar; 981. 982. return EC_POINTs_mul(group, r, g_scalar, ^ 983. (point != NULL 984. && p_scalar != NULL), points, scalars, ctx); crypto/ec/ec_lib.c:933:1: Parameter `scalar->top` 931. */ 932. 933. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 934. size_t num, const EC_POINT *points[], 935. const BIGNUM *scalars[], BN_CTX *ctx) crypto/ec/ec_lib.c:965:15: Call 963. else 964. /* use default */ 965. ret = ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); ^ 966. 967. BN_CTX_free(new_ctx); crypto/ec/ec_mult.c:410:1: Parameter `scalar->top` 408. * in the addition if scalar != NULL 409. */ 410. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 411. size_t num, const EC_POINT *points[], const BIGNUM *scalars[], 412. BN_CTX *ctx) crypto/ec/ec_mult.c:453:20: Call 451. * always call the ladder version. 452. */ 453. return ec_scalar_mul_ladder(group, r, scalar, NULL, ctx); ^ 454. } 455. if ((scalar == NULL) && (num == 1) && (scalars[0] != group->order)) { crypto/ec/ec_mult.c:139:1: Parameter `scalar->top` 137. * Returns 1 on success, 0 otherwise. 138. */ 139. > int ec_scalar_mul_ladder(const EC_GROUP *group, EC_POINT *r, 140. const BIGNUM *scalar, const EC_POINT *point, 141. BN_CTX *ctx) crypto/ec/ec_mult.c:215:10: Call 213. } 214. 215. if (!BN_copy(k, scalar)) { ^ 216. ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_BN_LIB); 217. goto err; crypto/bn/bn_lib.c:281:1: <Offset trace> 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: Parameter `b->top` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: <Length trace> 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: Parameter `*a->d` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:287:9: Call 285. if (a == b) 286. return a; 287. if (bn_wexpand(a, b->top) == NULL) ^ 288. return NULL; 289. crypto/bn/bn_lib.c:962:1: Parameter `*a->d` 960. } 961. 962. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 963. { 964. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:291:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_POINT_mul` 289. 290. if (b->top > 0) 291. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 292. 293. a->neg = b->neg;
https://github.com/openssl/openssl/blob/3051bf2afab7ac8b7b9c64e68755d1addd2fb8ff/crypto/bn/bn_lib.c/#L291
d2a_code_trace_data_42827
static void h261_loop_filter_c(uint8_t *src, int stride){ int x,y,xy,yz; int temp[64]; for(x=0; x<8; x++){ temp[x ] = 4*src[x ]; temp[x + 7*8] = 4*src[x + 7*stride]; } for(y=1; y<7; y++){ for(x=0; x<8; x++){ xy = y * stride + x; yz = y * 8 + x; temp[yz] = src[xy - stride] + 2*src[xy] + src[xy + stride]; } } for(y=0; y<8; y++){ src[ y*stride] = (temp[ y*8] + 2)>>2; src[7+y*stride] = (temp[7+y*8] + 2)>>2; for(x=1; x<7; x++){ xy = y * stride + x; yz = y * 8 + x; src[xy] = (temp[yz-1] + 2*temp[yz] + temp[yz+1] + 8)>>4; } } } libavcodec/dsputil.c:2911: error: Uninitialized Value The value read from temp[_] was never initialized. libavcodec/dsputil.c:2911:13: 2909. xy = y * stride + x; 2910. yz = y * 8 + x; 2911. src[xy] = (temp[yz-1] + 2*temp[yz] + temp[yz+1] + 8)>>4; ^ 2912. } 2913. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dsputil.c/#L2911
d2a_code_trace_data_42828
int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx) { if (!hmac_ctx_alloc_mds(dctx)) goto err; if (!EVP_MD_CTX_copy_ex(dctx->i_ctx, sctx->i_ctx)) goto err; if (!EVP_MD_CTX_copy_ex(dctx->o_ctx, sctx->o_ctx)) goto err; if (!EVP_MD_CTX_copy_ex(dctx->md_ctx, sctx->md_ctx)) goto err; memcpy(dctx->key, sctx->key, HMAC_MAX_MD_CBLOCK_SIZE); dctx->key_length = sctx->key_length; dctx->md = sctx->md; return 1; err: hmac_ctx_cleanup(dctx); return 0; } crypto/hmac/hmac.c:197: error: BUFFER_OVERRUN_L3 Offset added: 144 Size: [0, +oo]. Showing all 3 steps of the trace crypto/hmac/hmac.c:187:1: <Length trace> 185. } 186. 187. > int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx) 188. { 189. if (!hmac_ctx_alloc_mds(dctx)) crypto/hmac/hmac.c:187:1: Parameter `sctx->key[*]` 185. } 186. 187. > int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx) 188. { 189. if (!hmac_ctx_alloc_mds(dctx)) crypto/hmac/hmac.c:197:5: Array access: Offset added: 144 Size: [0, +oo] 195. if (!EVP_MD_CTX_copy_ex(dctx->md_ctx, sctx->md_ctx)) 196. goto err; 197. memcpy(dctx->key, sctx->key, HMAC_MAX_MD_CBLOCK_SIZE); ^ 198. dctx->key_length = sctx->key_length; 199. dctx->md = sctx->md;
https://github.com/openssl/openssl/blob/785e614a95a134831f213749332bcf40c4920f69/crypto/hmac/hmac.c/#L197
d2a_code_trace_data_42829
static const u_char * ngx_sha1_body(ngx_sha1_t *ctx, const u_char *data, size_t size) { uint32_t a, b, c, d, e, temp; uint32_t saved_a, saved_b, saved_c, saved_d, saved_e; uint32_t words[80]; ngx_uint_t i; const u_char *p; p = data; a = ctx->a; b = ctx->b; c = ctx->c; d = ctx->d; e = ctx->e; do { saved_a = a; saved_b = b; saved_c = c; saved_d = d; saved_e = e; for (i = 0; i < 16; i++) { words[i] = GET(i); } for (i = 16; i < 80; i++) { words[i] = ROTATE(1, words[i - 3] ^ words[i - 8] ^ words[i - 14] ^ words[i - 16]); } STEP(F1, a, b, c, d, e, words[0], 0x5a827999); STEP(F1, a, b, c, d, e, words[1], 0x5a827999); STEP(F1, a, b, c, d, e, words[2], 0x5a827999); STEP(F1, a, b, c, d, e, words[3], 0x5a827999); STEP(F1, a, b, c, d, e, words[4], 0x5a827999); STEP(F1, a, b, c, d, e, words[5], 0x5a827999); STEP(F1, a, b, c, d, e, words[6], 0x5a827999); STEP(F1, a, b, c, d, e, words[7], 0x5a827999); STEP(F1, a, b, c, d, e, words[8], 0x5a827999); STEP(F1, a, b, c, d, e, words[9], 0x5a827999); STEP(F1, a, b, c, d, e, words[10], 0x5a827999); STEP(F1, a, b, c, d, e, words[11], 0x5a827999); STEP(F1, a, b, c, d, e, words[12], 0x5a827999); STEP(F1, a, b, c, d, e, words[13], 0x5a827999); STEP(F1, a, b, c, d, e, words[14], 0x5a827999); STEP(F1, a, b, c, d, e, words[15], 0x5a827999); STEP(F1, a, b, c, d, e, words[16], 0x5a827999); STEP(F1, a, b, c, d, e, words[17], 0x5a827999); STEP(F1, a, b, c, d, e, words[18], 0x5a827999); STEP(F1, a, b, c, d, e, words[19], 0x5a827999); STEP(F2, a, b, c, d, e, words[20], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[21], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[22], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[23], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[24], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[25], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[26], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[27], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[28], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[29], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[30], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[31], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[32], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[33], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[34], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[35], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[36], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[37], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[38], 0x6ed9eba1); STEP(F2, a, b, c, d, e, words[39], 0x6ed9eba1); STEP(F3, a, b, c, d, e, words[40], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[41], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[42], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[43], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[44], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[45], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[46], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[47], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[48], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[49], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[50], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[51], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[52], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[53], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[54], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[55], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[56], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[57], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[58], 0x8f1bbcdc); STEP(F3, a, b, c, d, e, words[59], 0x8f1bbcdc); STEP(F2, a, b, c, d, e, words[60], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[61], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[62], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[63], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[64], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[65], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[66], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[67], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[68], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[69], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[70], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[71], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[72], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[73], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[74], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[75], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[76], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[77], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[78], 0xca62c1d6); STEP(F2, a, b, c, d, e, words[79], 0xca62c1d6); a += saved_a; b += saved_b; c += saved_c; d += saved_d; e += saved_e; p += 64; } while (size -= 64); ctx->a = a; ctx->b = b; ctx->c = c; ctx->d = d; ctx->e = e; return p; } src/core/ngx_sha1.c:274: error: Uninitialized Value The value read from words[_] was never initialized. src/core/ngx_sha1.c:274:9: 272. STEP(F2, a, b, c, d, e, words[76], 0xca62c1d6); 273. STEP(F2, a, b, c, d, e, words[77], 0xca62c1d6); 274. STEP(F2, a, b, c, d, e, words[78], 0xca62c1d6); ^ 275. STEP(F2, a, b, c, d, e, words[79], 0xca62c1d6); 276.
https://github.com/nginx/nginx/blob/70f7141074896fb1ff3e5fc08407ea0f64f2076b/src/core/ngx_sha1.c/#L274
d2a_code_trace_data_42830
int pem_check_suffix(const char *pem_str, const char *suffix) { int pem_len = strlen(pem_str); int suffix_len = strlen(suffix); const char *p; if (suffix_len + 1 >= pem_len) return 0; p = pem_str + pem_len - suffix_len; if (strcmp(p, suffix)) return 0; p--; if (*p != ' ') return 0; return p - pem_str; } crypto/pem/pem_pkey.c:79: error: BUFFER_OVERRUN_L3 Offset: [-12, +oo] Size: [1, 241] by call to `pem_check_suffix`. Showing all 10 steps of the trace crypto/pem/pem_pkey.c:35:10: Call 33. EVP_PKEY *ret = NULL; 34. 35. if (!PEM_bytes_read_bio_secmem(&data, &len, &nm, PEM_STRING_EVP_PKEY, bp, ^ 36. cb, u)) 37. return NULL; crypto/pem/pem_lib.c:285:12: Call 283. const char *name, BIO *bp, pem_password_cb *cb, 284. void *u) { 285. return pem_bytes_read_bio_flags(pdata, plen, pnm, name, bp, cb, u, ^ 286. PEM_FLAG_SECURE | PEM_FLAG_EAY_COMPATIBLE); 287. } crypto/pem/pem_lib.c:247:14: Call 245. pem_free(header, flags, 0); 246. pem_free(data, flags, len); 247. if (!PEM_read_bio_ex(bp, &nm, &header, &data, &len, flags)) { ^ 248. if (ERR_GET_REASON(ERR_peek_error()) == PEM_R_NO_START_LINE) 249. ERR_add_error_data(2, "Expecting: ", name); crypto/pem/pem_lib.c:947:5: Assignment 945. } 946. BIO_read(headerB, *header, headerlen); 947. (*header)[headerlen] = '\0'; ^ 948. BIO_read(dataB, *data, len); 949. *len_out = len; crypto/pem/pem_pkey.c:79:24: Call 77. } 78. PKCS8_PRIV_KEY_INFO_free(p8inf); 79. } else if ((slen = pem_check_suffix(nm, "PRIVATE KEY")) > 0) { ^ 80. const EVP_PKEY_ASN1_METHOD *ameth; 81. ameth = EVP_PKEY_asn1_find_str(NULL, nm, slen); crypto/pem/pem_lib.c:974:1: <Length trace> 972. */ 973. 974. > int pem_check_suffix(const char *pem_str, const char *suffix) 975. { 976. int pem_len = strlen(pem_str); crypto/pem/pem_lib.c:974:1: Parameter `*pem_str` 972. */ 973. 974. > int pem_check_suffix(const char *pem_str, const char *suffix) 975. { 976. int pem_len = strlen(pem_str); crypto/pem/pem_lib.c:981:5: Assignment 979. if (suffix_len + 1 >= pem_len) 980. return 0; 981. p = pem_str + pem_len - suffix_len; ^ 982. if (strcmp(p, suffix)) 983. return 0; crypto/pem/pem_lib.c:984:5: Assignment 982. if (strcmp(p, suffix)) 983. return 0; 984. p--; ^ 985. if (*p != ' ') 986. return 0; crypto/pem/pem_lib.c:985:9: Array access: Offset: [-12, +oo] Size: [1, 241] by call to `pem_check_suffix` 983. return 0; 984. p--; 985. if (*p != ' ') ^ 986. return 0; 987. return p - pem_str;
https://github.com/openssl/openssl/blob/32c6985349ba134761f75a3f61814234d096a1df/crypto/pem/pem_lib.c/#L985
d2a_code_trace_data_42831
DH *DSA_dup_DH(const DSA *r) { DH *ret = NULL; if (r == NULL) goto err; ret = DH_new(); if (ret == NULL) goto err; if (r->p != NULL) if ((ret->p = BN_dup(r->p)) == NULL) goto err; if (r->q != NULL) { ret->length = BN_num_bits(r->q); if ((ret->q = BN_dup(r->q)) == NULL) goto err; } if (r->g != NULL) if ((ret->g = BN_dup(r->g)) == NULL) goto err; if (r->pub_key != NULL) if ((ret->pub_key = BN_dup(r->pub_key)) == NULL) goto err; if (r->priv_key != NULL) if ((ret->priv_key = BN_dup(r->priv_key)) == NULL) goto err; return ret; err: DH_free(ret); return NULL; } crypto/dsa/dsa_lib.c:290: error: NULL_DEREFERENCE pointer `ret` last assigned on line 266 could be null and is dereferenced by call to `DH_free()` at line 290, column 5. Showing all 10 steps of the trace crypto/dsa/dsa_lib.c:255:1: start of procedure DSA_dup_DH() 253. 254. #ifndef OPENSSL_NO_DH 255. > DH *DSA_dup_DH(const DSA *r) 256. { 257. /* crypto/dsa/dsa_lib.c:262:5: 260. */ 261. 262. > DH *ret = NULL; 263. 264. if (r == NULL) crypto/dsa/dsa_lib.c:264:9: Taking false branch 262. DH *ret = NULL; 263. 264. if (r == NULL) ^ 265. goto err; 266. ret = DH_new(); crypto/dsa/dsa_lib.c:266:5: 264. if (r == NULL) 265. goto err; 266. > ret = DH_new(); 267. if (ret == NULL) 268. goto err; crypto/dh/dh_lib.c:103:1: start of procedure DH_new() 101. } 102. 103. > DH *DH_new(void) 104. { 105. return DH_new_method(NULL); crypto/dh/dh_lib.c:105:5: Skipping DH_new_method(): empty list of specs 103. DH *DH_new(void) 104. { 105. return DH_new_method(NULL); ^ 106. } 107. crypto/dh/dh_lib.c:106:1: return from a call to DH_new 104. { 105. return DH_new_method(NULL); 106. > } 107. 108. DH *DH_new_method(ENGINE *engine) crypto/dsa/dsa_lib.c:267:9: Taking true branch 265. goto err; 266. ret = DH_new(); 267. if (ret == NULL) ^ 268. goto err; 269. if (r->p != NULL) crypto/dsa/dsa_lib.c:289:2: 287. return ret; 288. 289. > err: 290. DH_free(ret); 291. return NULL; crypto/dsa/dsa_lib.c:290:5: 288. 289. err: 290. > DH_free(ret); 291. return NULL; 292. }
https://github.com/openssl/openssl/blob/57ce7b617c602ae8513c22daa2bda31f179edb0f/crypto/dsa/dsa_lib.c/#L290
d2a_code_trace_data_42832
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_ossl.c:625: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_MONT_CTX_set_locked`. Showing all 58 steps of the trace crypto/rsa/rsa_ossl.c:591:1: Parameter `ctx->stack.depth` 589. } 590. 591. > static int rsa_ossl_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) 592. { 593. BIGNUM *r1, *m1, *vrfy, *r2, *m[RSA_MAX_PRIME_NUM - 2]; crypto/rsa/rsa_ossl.c:597:5: Call 595. RSA_PRIME_INFO *pinfo; 596. 597. BN_CTX_start(ctx); ^ 598. 599. r1 = 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/rsa/rsa_ossl.c:599:10: Call 597. BN_CTX_start(ctx); 598. 599. r1 = BN_CTX_get(ctx); ^ 600. r2 = BN_CTX_get(ctx); 601. m1 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/rsa/rsa_ossl.c:600:10: Call 598. 599. r1 = BN_CTX_get(ctx); 600. r2 = BN_CTX_get(ctx); ^ 601. m1 = BN_CTX_get(ctx); 602. vrfy = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/rsa/rsa_ossl.c:601:10: Call 599. r1 = BN_CTX_get(ctx); 600. r2 = BN_CTX_get(ctx); 601. m1 = BN_CTX_get(ctx); ^ 602. vrfy = BN_CTX_get(ctx); 603. if (vrfy == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/rsa/rsa_ossl.c:602:12: Call 600. r2 = BN_CTX_get(ctx); 601. m1 = BN_CTX_get(ctx); 602. vrfy = BN_CTX_get(ctx); ^ 603. if (vrfy == NULL) 604. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/rsa/rsa_ossl.c:622:15: Call 620. */ 621. if (!(BN_with_flags(factor, rsa->p, BN_FLG_CONSTTIME), 622. BN_MONT_CTX_set_locked(&rsa->_method_mod_p, rsa->lock, ^ 623. factor, ctx)) 624. || !(BN_with_flags(factor, rsa->q, BN_FLG_CONSTTIME), crypto/bn/bn_mont.c:428:1: Parameter `ctx->stack.depth` 426. } 427. 428. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock, 429. const BIGNUM *mod, BN_CTX *ctx) 430. { crypto/rsa/rsa_ossl.c:625:18: Call 623. factor, ctx)) 624. || !(BN_with_flags(factor, rsa->q, BN_FLG_CONSTTIME), 625. BN_MONT_CTX_set_locked(&rsa->_method_mod_q, rsa->lock, ^ 626. factor, ctx))) { 627. BN_free(factor); crypto/bn/bn_mont.c:428:1: Parameter `ctx->stack.depth` 426. } 427. 428. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock, 429. const BIGNUM *mod, BN_CTX *ctx) 430. { crypto/bn/bn_mont.c:450:10: Call 448. if (ret == NULL) 449. return NULL; 450. if (!BN_MONT_CTX_set(ret, mod, ctx)) { ^ 451. BN_MONT_CTX_free(ret); 452. return NULL; crypto/bn/bn_mont.c:263:1: Parameter `ctx->stack.depth` 261. } 262. 263. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 264. { 265. int i, ret = 0; crypto/bn/bn_mont.c:271:5: Call 269. return 0; 270. 271. BN_CTX_start(ctx); ^ 272. if ((Ri = BN_CTX_get(ctx)) == NULL) 273. goto err; 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_mont.c:272:15: Call 270. 271. BN_CTX_start(ctx); 272. if ((Ri = BN_CTX_get(ctx)) == NULL) ^ 273. goto err; 274. R = &(mont->RR); /* grab RR as a temp */ crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mont.c:351:19: Call 349. if (BN_is_one(&tmod)) 350. BN_zero(Ri); 351. else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) ^ 352. goto err; 353. if (!BN_lshift(Ri, Ri, BN_BITS2)) crypto/bn/bn_gcd.c:124:1: Parameter `ctx->stack.depth` 122. BN_CTX *ctx); 123. 124. > BIGNUM *BN_mod_inverse(BIGNUM *in, 125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 126. { crypto/bn/bn_gcd.c:129:10: Call 127. BIGNUM *rv; 128. int noinv; 129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 130. if (noinv) 131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth` 133. } 134. 135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 137. int *pnoinv) crypto/bn/bn_gcd.c:155:16: Call 153. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 154. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 155. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 156. } 157. crypto/bn/bn_gcd.c:458:1: Parameter `ctx->stack.depth` 456. * not contain branches that may leak sensitive information. 457. */ 458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 459. const BIGNUM *a, const BIGNUM *n, 460. BN_CTX *ctx) crypto/bn/bn_gcd.c:469:5: Call 467. bn_check_top(n); 468. 469. BN_CTX_start(ctx); ^ 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gcd.c:470:9: Call 468. 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); ^ 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:471:9: Call 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); ^ 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:472:9: Call 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); ^ 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:473:9: Call 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); ^ 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:474:9: Call 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); ^ 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:475:9: Call 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); ^ 476. T = BN_CTX_get(ctx); 477. if (T == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:476:9: Call 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); ^ 477. if (T == NULL) 478. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:504:18: Call 502. bn_init(&local_B); 503. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 504. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 505. goto err; 506. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_MONT_CTX_set_locked` 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_42833
tmsize_t TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size) { static const char module[] = "TIFFReadEncodedStrip"; TIFFDirectory *td = &tif->tif_dir; uint32 rowsperstrip; uint32 stripsperplane; uint32 stripinplane; uint16 plane; uint32 rows; tmsize_t stripsize; if (!TIFFCheckRead(tif,0)) return((tmsize_t)(-1)); if (strip>=td->td_nstrips) { TIFFErrorExt(tif->tif_clientdata,module, "%lu: Strip out of range, max %lu",(unsigned long)strip, (unsigned long)td->td_nstrips); return((tmsize_t)(-1)); } rowsperstrip=td->td_rowsperstrip; if (rowsperstrip>td->td_imagelength) rowsperstrip=td->td_imagelength; stripsperplane=((td->td_imagelength+rowsperstrip-1)/rowsperstrip); stripinplane=(strip%stripsperplane); plane=(strip/stripsperplane); rows=td->td_imagelength-stripinplane*rowsperstrip; if (rows>rowsperstrip) rows=rowsperstrip; stripsize=TIFFVStripSize(tif,rows); if (stripsize==0) return((tmsize_t)(-1)); if ((size!=(tmsize_t)(-1))&&(size<stripsize)) stripsize=size; if (!TIFFFillStrip(tif,strip)) return((tmsize_t)(-1)); if ((*tif->tif_decodestrip)(tif,buf,stripsize,plane)<=0) return((tmsize_t)(-1)); (*tif->tif_postdecode)(tif,buf,stripsize); return(stripsize); } libtiff/tif_getimage.c:927: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `TIFFReadEncodedStrip`. libtiff/tif_getimage.c:898:14: Call 896. int ret = 1, flip; 897. 898. stripsize = TIFFStripSize(tif); ^ 899. p0 = buf = (unsigned char *)_TIFFmalloc((alpha?4:3)*stripsize); 900. if (buf == 0) { libtiff/tif_strip.c:235:1: Parameter `tif->tif_dir.td_imagelength` 233. return (TIFFVStripSize64(tif, rps)); 234. } 235. tmsize_t ^ 236. TIFFStripSize(TIFF* tif) 237. { libtiff/tif_strip.c:241:4: Call 239. uint64 m; 240. tmsize_t n; 241. m=TIFFStripSize64(tif); ^ 242. n=(tmsize_t)m; 243. if ((uint64)n!=m) libtiff/tif_strip.c:226:1: Parameter `tif->tif_dir.td_imagelength` 224. * to hold the strip. 225. */ 226. uint64 ^ 227. TIFFStripSize64(TIFF* tif) 228. { libtiff/tif_getimage.c:927:7: Call 925. nrow = (row + rowstoread > h ? h - row : rowstoread); 926. offset_row = row + img->row_offset; 927. if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, offset_row, 0), ^ 928. p0, ((row + img->row_offset)%rowsperstrip + nrow) * scanline)!=(tmsize_t)(-1) 929. && img->stoponerr) libtiff/tif_read.c:123:1: <LHS trace> 121. * amount into the user-supplied buffer. 122. */ 123. tmsize_t ^ 124. TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size) 125. { libtiff/tif_read.c:123:1: Parameter `tif->tif_dir.td_imagelength` 121. * amount into the user-supplied buffer. 122. */ 123. tmsize_t ^ 124. TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size) 125. { libtiff/tif_read.c:151:2: Binary operation: ([0, +oo] - 1):unsigned32 by call to `TIFFReadEncodedStrip` 149. if (rowsperstrip>td->td_imagelength) 150. rowsperstrip=td->td_imagelength; 151. stripsperplane=((td->td_imagelength+rowsperstrip-1)/rowsperstrip); ^ 152. stripinplane=(strip%stripsperplane); 153. plane=(strip/stripsperplane);
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_read.c/#L151
d2a_code_trace_data_42834
int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d) { static const int min[9] = { 0, 0, 1, 1, 0, 0, 0, 0, 0 }; static const int max[9] = { 99, 99, 12, 31, 23, 59, 59, 12, 59 }; static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; char *a; int n, i, i2, l, o, min_l = 11, strict = 0, end = 6, btz = 5, md; struct tm tmp; if (d->type == V_ASN1_UTCTIME) { if (d->flags & ASN1_STRING_FLAG_X509_TIME) { min_l = 13; strict = 1; } } else if (d->type == V_ASN1_GENERALIZEDTIME) { end = 7; btz = 6; if (d->flags & ASN1_STRING_FLAG_X509_TIME) { min_l = 15; strict = 1; } else { min_l = 13; } } else { return 0; } l = d->length; a = (char *)d->data; o = 0; memset(&tmp, 0, sizeof(tmp)); if (l < min_l) goto err; for (i = 0; i < end; i++) { if (!strict && (i == btz) && ((a[o] == 'Z') || (a[o] == '+') || (a[o] == '-'))) { i++; break; } if ((a[o] < '0') || (a[o] > '9')) goto err; n = a[o] - '0'; if (++o == l) goto err; if ((a[o] < '0') || (a[o] > '9')) goto err; n = (n * 10) + a[o] - '0'; if (++o == l) goto err; i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i; if ((n < min[i2]) || (n > max[i2])) goto err; switch (i2) { case 0: tmp.tm_year = n * 100 - 1900; break; case 1: if (d->type == V_ASN1_UTCTIME) tmp.tm_year = n < 50 ? n + 100 : n; else tmp.tm_year += n; break; case 2: tmp.tm_mon = n - 1; break; case 3: if (tmp.tm_mon == 1) { md = mdays[1] + leap_year(tmp.tm_year + 1900); } else { md = mdays[tmp.tm_mon]; } if (n > md) goto err; tmp.tm_mday = n; break; case 4: tmp.tm_hour = n; break; case 5: tmp.tm_min = n; break; case 6: tmp.tm_sec = n; break; } } if (d->type == V_ASN1_GENERALIZEDTIME && a[o] == '.') { if (strict) goto err; if (++o == l) goto err; i = o; while ((o < l) && (a[o] >= '0') && (a[o] <= '9')) o++; if (i == o) goto err; if (o == l) goto err; } if (a[o] == 'Z') { o++; } else if (!strict && ((a[o] == '+') || (a[o] == '-'))) { int offsign = a[o] == '-' ? 1 : -1; int offset = 0; o++; if (o + 4 != l) goto err; for (i = end; i < end + 2; i++) { if ((a[o] < '0') || (a[o] > '9')) goto err; n = a[o] - '0'; o++; if ((a[o] < '0') || (a[o] > '9')) goto err; n = (n * 10) + a[o] - '0'; i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i; if ((n < min[i2]) || (n > max[i2])) goto err; if (tm != NULL) { if (i == end) offset = n * 3600; else if (i == end + 1) offset += n * 60; } o++; } if (offset && !OPENSSL_gmtime_adj(&tmp, 0, offset * offsign)) goto err; } else { goto err; } if (o == l) { if (tm != NULL) *tm = tmp; return 1; } err: return 0; } crypto/asn1/a_time.c:193: error: BUFFER_OVERRUN_L2 Offset: [6, 9] Size: 9. Showing all 7 steps of the trace crypto/asn1/a_time.c:40:5: <Offset trace> 38. static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 39. char *a; 40. int n, i, i2, l, o, min_l = 11, strict = 0, end = 6, btz = 5, md; ^ 41. struct tm tmp; 42. crypto/asn1/a_time.c:40:5: Assignment 38. static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 39. char *a; 40. int n, i, i2, l, o, min_l = 11, strict = 0, end = 6, btz = 5, md; ^ 41. struct tm tmp; 42. crypto/asn1/a_time.c:192:18: Assignment 190. goto err; 191. n = (n * 10) + a[o] - '0'; 192. i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i; ^ 193. if ((n < min[i2]) || (n > max[i2])) 194. goto err; crypto/asn1/a_time.c:192:13: Assignment 190. goto err; 191. n = (n * 10) + a[o] - '0'; 192. i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i; ^ 193. if ((n < min[i2]) || (n > max[i2])) 194. goto err; crypto/asn1/a_time.c:37:5: <Length trace> 35. { 36. static const int min[9] = { 0, 0, 1, 1, 0, 0, 0, 0, 0 }; 37. static const int max[9] = { 99, 99, 12, 31, 23, 59, 59, 12, 59 }; ^ 38. static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 39. char *a; crypto/asn1/a_time.c:37:5: Array declaration 35. { 36. static const int min[9] = { 0, 0, 1, 1, 0, 0, 0, 0, 0 }; 37. static const int max[9] = { 99, 99, 12, 31, 23, 59, 59, 12, 59 }; ^ 38. static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 39. char *a; crypto/asn1/a_time.c:193:39: Array access: Offset: [6, 9] Size: 9 191. n = (n * 10) + a[o] - '0'; 192. i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i; 193. if ((n < min[i2]) || (n > max[i2])) ^ 194. goto err; 195. /* if tm is NULL, no need to adjust */
https://github.com/openssl/openssl/blob/3d0f1cb9fdd630c6c920bc97bf496538717e7705/crypto/asn1/a_time.c/#L193
d2a_code_trace_data_42835
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:464: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 457, column 9 is not reachable after line 464, column 17. Showing all 133 steps of the trace test/bntest.c:449:1: start of procedure test_div() 447. } 448. 449. > int test_div(BIO *bp, BN_CTX *ctx) 450. { 451. BIGNUM *a, *b, *c, *d, *e; test/bntest.c:454:5: 452. int i; 453. 454. > a = BN_new(); 455. b = BN_new(); 456. 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:455:5: 453. 454. a = BN_new(); 455. > b = BN_new(); 456. c = BN_new(); 457. 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:456:5: 454. a = BN_new(); 455. b = BN_new(); 456. > c = BN_new(); 457. d = BN_new(); 458. 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:457:5: 455. b = BN_new(); 456. c = BN_new(); 457. > d = BN_new(); 458. e = BN_new(); 459. 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:458:5: 456. c = BN_new(); 457. d = BN_new(); 458. > e = BN_new(); 459. 460. 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:460:5: 458. e = BN_new(); 459. 460. > BN_one(a); 461. BN_zero(b); 462. 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:461:5: 459. 460. BN_one(a); 461. > BN_zero(b); 462. 463. 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:463:9: Taking true branch 461. BN_zero(b); 462. 463. if (BN_div(d, c, a, b, ctx)) { ^ 464. fprintf(stderr, "Division by zero succeeded!\n"); 465. return 0; test/bntest.c:464:9: 462. 463. if (BN_div(d, c, a, b, ctx)) { 464. > fprintf(stderr, "Division by zero succeeded!\n"); 465. return 0; 466. }
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L464
d2a_code_trace_data_42836
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return (0); r->neg = a->neg; lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return (1); } test/srptest.c:150: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN`. Showing all 20 steps of the trace test/srptest.c:150:10: Call 148. BN_hex2bn(&s, "BEB25379D1A8581EB5A727673A2441EE"); 149. /* Set up server's password entry */ 150. if (!TEST_true(SRP_create_verifier_BN("alice", "password123", &s, &v, GN->N, ^ 151. GN->g))) 152. goto err; crypto/srp/srp_vfy.c:633:1: Parameter `g->top` 631. * BIGNUMS. 632. */ 633. > int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, 634. BIGNUM **verifier, const BIGNUM *N, 635. const BIGNUM *g) crypto/srp/srp_vfy.c:664:10: Call 662. goto err; 663. 664. if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) { ^ 665. BN_clear_free(*verifier); 666. goto err; crypto/bn/bn_exp.c:91:1: Parameter `a->top` 89. } 90. 91. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 92. BN_CTX *ctx) 93. { crypto/bn/bn_exp.c:144:19: Call 142. } else 143. # endif 144. ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL); ^ 145. } else 146. #endif crypto/bn/bn_exp.c:294:1: Parameter `a->top` 292. } 293. 294. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 295. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 296. { crypto/bn/bn_exp.c:306:16: Call 304. 305. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 306. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 307. } 308. crypto/bn/bn_exp.c:594:1: Parameter `a->top` 592. * http://www.daemonology.net/hyperthreading-considered-harmful/) 593. */ 594. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 595. const BIGNUM *m, BN_CTX *ctx, 596. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:747:14: Call 745. /* prepare a^1 in Montgomery domain */ 746. if (a->neg || BN_ucmp(a, m) >= 0) { 747. if (!BN_mod(&am, a, m, ctx)) ^ 748. goto err; 749. if (!BN_to_montgomery(&am, &am, mont, ctx)) crypto/bn/bn_div.c:140:1: Parameter `num->top` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { crypto/bn/bn_div.c:210:11: Call 208. sdiv->neg = 0; 209. norm_shift += BN_BITS2; 210. if (!(BN_lshift(snum, num, norm_shift))) ^ 211. goto err; 212. snum->neg = 0; crypto/bn/bn_shift.c:83:1: <Offset trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `n` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:5: Assignment 95. } 96. 97. nw = n / BN_BITS2; ^ 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) 99. return (0); crypto/bn/bn_shift.c:83:1: <Length trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `*r->d` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:98:9: Call 96. 97. nw = n / BN_BITS2; 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 99. return (0); 100. r->neg = a->neg; crypto/bn/bn_lib.c:948:1: Parameter `*a->d` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:104:5: Assignment 102. rb = BN_BITS2 - lb; 103. f = a->d; 104. t = r->d; ^ 105. t[a->top + nw] = 0; 106. if (lb == 0) crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN` 110. for (i = a->top - 1; i >= 0; i--) { 111. l = f[i]; 112. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 113. t[nw + i] = (l << lb) & BN_MASK2; 114. }
https://github.com/openssl/openssl/blob/6ea3bca427b3e759939a63555821d0c4678dd79c/crypto/bn/bn_shift.c/#L112
d2a_code_trace_data_42837
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } crypto/dsa/dsa_ossl.c:102: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_mod_mul`. Showing all 17 steps of the trace crypto/dsa/dsa_ossl.c:81:10: Call 79. goto err; 80. redo: 81. if (!dsa_sign_setup(dsa, ctx, &kinv, &ret->r, dgst, dlen)) ^ 82. goto err; 83. crypto/dsa/dsa_ossl.c:133:1: Parameter `(*rp)->top` 131. } 132. 133. > static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, 134. BIGNUM **kinvp, BIGNUM **rp, 135. const unsigned char *dgst, int dlen) crypto/dsa/dsa_ossl.c:102:10: Call 100. if (!BN_sub(ret->s, ret->s, dsa->q)) 101. goto err; 102. if (!BN_mod_mul(ret->s, ret->s, kinv, dsa->q, ctx)) ^ 103. goto err; 104. crypto/bn/bn_mod.c:73:1: Parameter `a->top` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/bn/bn_mod.c:87:14: Call 85. goto err; 86. if (a == b) { 87. if (!BN_sqr(t, a, ctx)) ^ 88. goto err; 89. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:104:1: <Offset trace> 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:104:1: Parameter `n` 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:115:5: Assignment 113. rp[0] = rp[max - 1] = 0; 114. rp++; 115. j = n; ^ 116. 117. if (--j > 0) { crypto/bn/bn_sqr.c:117:9: Assignment 115. j = n; 116. 117. if (--j > 0) { ^ 118. ap++; 119. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:104:1: <Length trace> 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:104:1: Parameter `*r` 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:112:5: Assignment 110. max = n * 2; 111. ap = a; 112. rp = r; ^ 113. rp[0] = rp[max - 1] = 0; 114. rp++; crypto/bn/bn_sqr.c:114:5: Assignment 112. rp = r; 113. rp[0] = rp[max - 1] = 0; 114. rp++; ^ 115. j = n; 116. crypto/bn/bn_sqr.c:119:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_mod_mul` 117. if (--j > 0) { 118. ap++; 119. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 120. rp += 2; 121. }
https://github.com/openssl/openssl/blob/69588edbaa424beb71c6a9b1be416588232cb78c/crypto/bn/bn_sqr.c/#L119
d2a_code_trace_data_42838
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_client.c:2586: error: BUFFER_OVERRUN_L2 Offset: [-oo, 1048576] Size: 8192 by call to `X509_NAME_oneline`. Showing all 6 steps of the trace apps/s_client.c:2560:1: Array declaration 2558. } 2559. 2560. > static void print_stuff(BIO *bio, SSL *s, int full) 2561. { 2562. X509 *peer = NULL; apps/s_client.c:2586:17: Call 2584. BIO_printf(bio, "---\nCertificate chain\n"); 2585. for (i = 0; i < sk_X509_num(sk); i++) { 2586. X509_NAME_oneline(X509_get_subject_name(sk_X509_value(sk, i)), ^ 2587. buf, sizeof buf); 2588. BIO_printf(bio, "%2d s:%s\n", i, buf); 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: Assignment 179. break; 180. } else 181. p = &(buf[lold]); ^ 182. *(p++) = '/'; 183. memcpy(p, s, (unsigned int)l1); crypto/x509/x509_obj.c:182:9: Array access: Offset: [-oo, 1048576] Size: 8192 by call to `X509_NAME_oneline` 180. } else 181. p = &(buf[lold]); 182. *(p++) = '/'; ^ 183. memcpy(p, s, (unsigned int)l1); 184. p += l1;
https://github.com/openssl/openssl/blob/24c2cd3967ed23acc0bd31a3781c4525e2e42a2c/crypto/x509/x509_obj.c/#L182
d2a_code_trace_data_42839
int RAND_status(void) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->status != NULL) return meth->status(); return 0; } crypto/rand/rand_lib.c:794: error: NULL_DEREFERENCE pointer `meth` last assigned on line 792 could be null and is dereferenced at line 794, column 9. Showing all 14 steps of the trace crypto/rand/rand_lib.c:790:1: start of procedure RAND_status() 788. #endif 789. 790. > int RAND_status(void) 791. { 792. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:792:5: 790. int RAND_status(void) 791. { 792. > const RAND_METHOD *meth = RAND_get_rand_method(); 793. 794. if (meth->status != NULL) crypto/rand/rand_lib.c:671:1: start of procedure RAND_get_rand_method() 669. #endif 670. 671. > const RAND_METHOD *RAND_get_rand_method(void) 672. { 673. #ifdef FIPS_MODE crypto/rand/rand_lib.c:676:5: 674. return NULL; 675. #else 676. > const RAND_METHOD *tmp_meth = NULL; 677. 678. if (!RUN_ONCE(&rand_init, do_rand_init)) crypto/rand/rand_lib.c:678:10: 676. const RAND_METHOD *tmp_meth = NULL; 677. 678. > if (!RUN_ONCE(&rand_init, do_rand_init)) 679. return NULL; 680. 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:678:10: Condition is false 676. const RAND_METHOD *tmp_meth = NULL; 677. 678. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 679. return NULL; 680. crypto/rand/rand_lib.c:678:10: Taking true branch 676. const RAND_METHOD *tmp_meth = NULL; 677. 678. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 679. return NULL; 680. crypto/rand/rand_lib.c:679:9: 677. 678. if (!RUN_ONCE(&rand_init, do_rand_init)) 679. > return NULL; 680. 681. CRYPTO_THREAD_write_lock(rand_meth_lock); crypto/rand/rand_lib.c:703:1: return from a call to RAND_get_rand_method 701. return tmp_meth; 702. #endif 703. > } 704. 705. #if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) crypto/rand/rand_lib.c:794:9: 792. const RAND_METHOD *meth = RAND_get_rand_method(); 793. 794. > if (meth->status != NULL) 795. return meth->status(); 796. return 0;
https://github.com/openssl/openssl/blob/37ca204b96b036f949b8bc8389c1f8e806e1cbec/crypto/rand/rand_lib.c/#L794
d2a_code_trace_data_42840
EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) { ssl_clear_hash_ctx(hash); *hash = EVP_MD_CTX_new(); if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { EVP_MD_CTX_free(*hash); *hash = NULL; return NULL; } return *hash; } ssl/ssl_lib.c:3723: error: MEMORY_LEAK memory dynamically allocated to `*hash` by call to `EVP_MD_CTX_new()` at line 3720, column 13 is not reachable after line 3723, column 9. Showing all 50 steps of the trace ssl/ssl_lib.c:3717:1: start of procedure ssl_replace_hash() 3715. */ 3716. 3717. > EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) 3718. { 3719. ssl_clear_hash_ctx(hash); ssl/ssl_lib.c:3719:5: 3717. EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) 3718. { 3719. > ssl_clear_hash_ctx(hash); 3720. *hash = EVP_MD_CTX_new(); 3721. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ssl/ssl_lib.c:3729:1: start of procedure ssl_clear_hash_ctx() 3727. } 3728. 3729. > void ssl_clear_hash_ctx(EVP_MD_CTX **hash) 3730. { 3731. ssl/ssl_lib.c:3732:9: Taking true branch 3730. { 3731. 3732. if (*hash) ^ 3733. EVP_MD_CTX_free(*hash); 3734. *hash = NULL; ssl/ssl_lib.c:3733:9: 3731. 3732. if (*hash) 3733. > EVP_MD_CTX_free(*hash); 3734. *hash = NULL; 3735. } crypto/evp/digest.c:150:1: start of procedure EVP_MD_CTX_free() 148. } 149. 150. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 151. { 152. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:152:5: Skipping EVP_MD_CTX_reset(): empty list of specs 150. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 151. { 152. EVP_MD_CTX_reset(ctx); ^ 153. OPENSSL_free(ctx); 154. } crypto/evp/digest.c:153:5: 151. { 152. EVP_MD_CTX_reset(ctx); 153. > OPENSSL_free(ctx); 154. } 155. crypto/mem.c:210:1: start of procedure CRYPTO_free() 208. } 209. 210. > void CRYPTO_free(void *str, const char *file, int line) 211. { 212. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:212:9: Taking false branch 210. void CRYPTO_free(void *str, const char *file, int line) 211. { 212. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 213. free_impl(str, file, line); 214. return; crypto/mem.c:226:5: 224. } 225. #else 226. > free(str); 227. #endif 228. } crypto/mem.c:228:1: return from a call to CRYPTO_free 226. free(str); 227. #endif 228. > } 229. 230. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:154:1: return from a call to EVP_MD_CTX_free 152. EVP_MD_CTX_reset(ctx); 153. OPENSSL_free(ctx); 154. > } 155. 156. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) ssl/ssl_lib.c:3734:5: 3732. if (*hash) 3733. EVP_MD_CTX_free(*hash); 3734. > *hash = NULL; 3735. } 3736. ssl/ssl_lib.c:3735:1: return from a call to ssl_clear_hash_ctx 3733. EVP_MD_CTX_free(*hash); 3734. *hash = NULL; 3735. > } 3736. 3737. /* Retrieve handshake hashes */ ssl/ssl_lib.c:3720:5: 3718. { 3719. ssl_clear_hash_ctx(hash); 3720. > *hash = EVP_MD_CTX_new(); 3721. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 3722. EVP_MD_CTX_free(*hash); crypto/evp/digest.c:145:1: start of procedure EVP_MD_CTX_new() 143. } 144. 145. > EVP_MD_CTX *EVP_MD_CTX_new(void) 146. { 147. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); crypto/evp/digest.c:147:5: 145. EVP_MD_CTX *EVP_MD_CTX_new(void) 146. { 147. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 148. } 149. crypto/mem.c:146:1: start of procedure CRYPTO_zalloc() 144. } 145. 146. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 147. { 148. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:148:5: 146. void *CRYPTO_zalloc(size_t num, const char *file, int line) 147. { 148. > void *ret = CRYPTO_malloc(num, file, line); 149. 150. if (ret != NULL) crypto/mem.c:119:1: start of procedure CRYPTO_malloc() 117. } 118. 119. > void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. void *ret = NULL; crypto/mem.c:121:5: 119. void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. > void *ret = NULL; 122. 123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:123:9: Taking false branch 121. void *ret = NULL; 122. 123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 124. return malloc_impl(num, file, line); 125. crypto/mem.c:126:9: Taking false branch 124. return malloc_impl(num, file, line); 125. 126. if (num <= 0) ^ 127. return NULL; 128. crypto/mem.c:129:5: 127. return NULL; 128. 129. > allow_customize = 0; 130. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 131. if (call_malloc_debug) { crypto/mem.c:139:5: 137. } 138. #else 139. > osslargused(file); osslargused(line); 140. ret = malloc(num); 141. #endif crypto/mem.c:139:24: 137. } 138. #else 139. > osslargused(file); osslargused(line); 140. ret = malloc(num); 141. #endif crypto/mem.c:140:5: 138. #else 139. osslargused(file); osslargused(line); 140. > ret = malloc(num); 141. #endif 142. crypto/mem.c:143:5: 141. #endif 142. 143. > return ret; 144. } 145. crypto/mem.c:144:1: return from a call to CRYPTO_malloc 142. 143. return ret; 144. > } 145. 146. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:150:9: Taking true branch 148. void *ret = CRYPTO_malloc(num, file, line); 149. 150. if (ret != NULL) ^ 151. memset(ret, 0, num); 152. return ret; crypto/mem.c:151:9: 149. 150. if (ret != NULL) 151. > memset(ret, 0, num); 152. return ret; 153. } crypto/mem.c:152:5: 150. if (ret != NULL) 151. memset(ret, 0, num); 152. > return ret; 153. } 154. crypto/mem.c:153:1: return from a call to CRYPTO_zalloc 151. memset(ret, 0, num); 152. return ret; 153. > } 154. 155. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:148:1: return from a call to EVP_MD_CTX_new 146. { 147. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 148. > } 149. 150. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) ssl/ssl_lib.c:3721:9: Taking false branch 3719. ssl_clear_hash_ctx(hash); 3720. *hash = EVP_MD_CTX_new(); 3721. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 3722. EVP_MD_CTX_free(*hash); 3723. *hash = NULL; ssl/ssl_lib.c:3721:27: Taking true branch 3719. ssl_clear_hash_ctx(hash); 3720. *hash = EVP_MD_CTX_new(); 3721. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 3722. EVP_MD_CTX_free(*hash); 3723. *hash = NULL; ssl/ssl_lib.c:3721:33: Taking true branch 3719. ssl_clear_hash_ctx(hash); 3720. *hash = EVP_MD_CTX_new(); 3721. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 3722. EVP_MD_CTX_free(*hash); 3723. *hash = NULL; ssl/ssl_lib.c:3722:9: 3720. *hash = EVP_MD_CTX_new(); 3721. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 3722. > EVP_MD_CTX_free(*hash); 3723. *hash = NULL; 3724. return NULL; crypto/evp/digest.c:150:1: start of procedure EVP_MD_CTX_free() 148. } 149. 150. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 151. { 152. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:152:5: Skipping EVP_MD_CTX_reset(): empty list of specs 150. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 151. { 152. EVP_MD_CTX_reset(ctx); ^ 153. OPENSSL_free(ctx); 154. } crypto/evp/digest.c:153:5: 151. { 152. EVP_MD_CTX_reset(ctx); 153. > OPENSSL_free(ctx); 154. } 155. crypto/mem.c:210:1: start of procedure CRYPTO_free() 208. } 209. 210. > void CRYPTO_free(void *str, const char *file, int line) 211. { 212. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:212:9: Taking true branch 210. void CRYPTO_free(void *str, const char *file, int line) 211. { 212. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 213. free_impl(str, file, line); 214. return; crypto/mem.c:212:30: Taking true branch 210. void CRYPTO_free(void *str, const char *file, int line) 211. { 212. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 213. free_impl(str, file, line); 214. return; crypto/mem.c:213:9: Skipping __function_pointer__(): unresolved function pointer 211. { 212. if (free_impl != NULL && free_impl != &CRYPTO_free) { 213. free_impl(str, file, line); ^ 214. return; 215. } crypto/mem.c:214:9: 212. if (free_impl != NULL && free_impl != &CRYPTO_free) { 213. free_impl(str, file, line); 214. > return; 215. } 216. crypto/mem.c:228:1: return from a call to CRYPTO_free 226. free(str); 227. #endif 228. > } 229. 230. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:154:1: return from a call to EVP_MD_CTX_free 152. EVP_MD_CTX_reset(ctx); 153. OPENSSL_free(ctx); 154. > } 155. 156. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) ssl/ssl_lib.c:3723:9: 3721. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 3722. EVP_MD_CTX_free(*hash); 3723. > *hash = NULL; 3724. return NULL; 3725. }
https://github.com/openssl/openssl/blob/6457615ac82d688a965c9b2cce9611e0559635be/ssl/ssl_lib.c/#L3723
d2a_code_trace_data_42841
static int opt_input_ts_scale(const char *opt, const char *arg) { unsigned int stream; double scale; char *p; stream = strtol(arg, &p, 0); if (*p) p++; scale= strtod(p, &p); ts_scale = grow_array(ts_scale, sizeof(*ts_scale), &nb_ts_scale, stream + 1); ts_scale[stream] = scale; return 0; } ffmpeg.c:3078: error: Null Dereference pointer `ts_scale` last assigned on line 3077 could be null and is dereferenced at line 3078, column 5. ffmpeg.c:3066:1: start of procedure opt_input_ts_scale() 3064. } 3065. 3066. static int opt_input_ts_scale(const char *opt, const char *arg) ^ 3067. { 3068. unsigned int stream; ffmpeg.c:3072:5: 3070. char *p; 3071. 3072. stream = strtol(arg, &p, 0); ^ 3073. if (*p) 3074. p++; ffmpeg.c:3073:9: Taking true branch 3071. 3072. stream = strtol(arg, &p, 0); 3073. if (*p) ^ 3074. p++; 3075. scale= strtod(p, &p); ffmpeg.c:3074:9: 3072. stream = strtol(arg, &p, 0); 3073. if (*p) 3074. p++; ^ 3075. scale= strtod(p, &p); 3076. ffmpeg.c:3075:5: 3073. if (*p) 3074. p++; 3075. scale= strtod(p, &p); ^ 3076. 3077. ts_scale = grow_array(ts_scale, sizeof(*ts_scale), &nb_ts_scale, stream + 1); ffmpeg.c:3077:5: 3075. scale= strtod(p, &p); 3076. 3077. ts_scale = grow_array(ts_scale, sizeof(*ts_scale), &nb_ts_scale, stream + 1); ^ 3078. ts_scale[stream] = scale; 3079. return 0; cmdutils.c:994:1: start of procedure grow_array() 992. #endif /* CONFIG_AVFILTER */ 993. 994. void *grow_array(void *array, int elem_size, int *size, int new_size) ^ 995. { 996. if (new_size >= INT_MAX / elem_size) { cmdutils.c:996:9: Taking true branch 994. void *grow_array(void *array, int elem_size, int *size, int new_size) 995. { 996. if (new_size >= INT_MAX / elem_size) { ^ 997. av_log(NULL, AV_LOG_ERROR, "Array too big.\n"); 998. exit_program(1); cmdutils.c:997:9: Skipping av_log(): empty list of specs 995. { 996. if (new_size >= INT_MAX / elem_size) { 997. av_log(NULL, AV_LOG_ERROR, "Array too big.\n"); ^ 998. exit_program(1); 999. } cmdutils.c:998:9: Skipping exit_program(): empty list of specs 996. if (new_size >= INT_MAX / elem_size) { 997. av_log(NULL, AV_LOG_ERROR, "Array too big.\n"); 998. exit_program(1); ^ 999. } 1000. if (*size < new_size) { cmdutils.c:1000:9: Taking true branch 998. exit_program(1); 999. } 1000. if (*size < new_size) { ^ 1001. uint8_t *tmp = av_realloc(array, new_size*elem_size); 1002. if (!tmp) { cmdutils.c:1001:9: 999. } 1000. if (*size < new_size) { 1001. uint8_t *tmp = av_realloc(array, new_size*elem_size); ^ 1002. if (!tmp) { 1003. av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n"); libavutil/mem.c:117:1: start of procedure av_realloc() 115. } 116. 117. void *av_realloc(void *ptr, size_t size) ^ 118. { 119. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:124:8: Taking false branch 122. 123. /* let's disallow possible ambiguous cases */ 124. if(size > (INT_MAX-16) ) ^ 125. return NULL; 126. libavutil/mem.c:133:5: 131. return (char*)realloc((char*)ptr - diff, size + diff) + diff; 132. #else 133. return realloc(ptr, size); ^ 134. #endif 135. } libavutil/mem.c:135:1: return from a call to av_realloc 133. return realloc(ptr, size); 134. #endif 135. } ^ 136. 137. void av_free(void *ptr) cmdutils.c:1002:14: Taking true branch 1000. if (*size < new_size) { 1001. uint8_t *tmp = av_realloc(array, new_size*elem_size); 1002. if (!tmp) { ^ 1003. av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n"); 1004. exit_program(1); cmdutils.c:1003:13: Skipping av_log(): empty list of specs 1001. uint8_t *tmp = av_realloc(array, new_size*elem_size); 1002. if (!tmp) { 1003. av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n"); ^ 1004. exit_program(1); 1005. } cmdutils.c:1004:13: Skipping exit_program(): empty list of specs 1002. if (!tmp) { 1003. av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n"); 1004. exit_program(1); ^ 1005. } 1006. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); cmdutils.c:1006:9: 1004. exit_program(1); 1005. } 1006. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ^ 1007. *size = new_size; 1008. return tmp; cmdutils.c:1007:9: 1005. } 1006. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 1007. *size = new_size; ^ 1008. return tmp; 1009. } cmdutils.c:1008:9: 1006. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 1007. *size = new_size; 1008. return tmp; ^ 1009. } 1010. return array; cmdutils.c:1011:1: return from a call to grow_array 1009. } 1010. return array; 1011. } ^ ffmpeg.c:3078:5: 3076. 3077. ts_scale = grow_array(ts_scale, sizeof(*ts_scale), &nb_ts_scale, stream + 1); 3078. ts_scale[stream] = scale; ^ 3079. return 0; 3080. }
https://github.com/libav/libav/blob/9fba8ebe0acdc28193d37b5e1f4c0d73c589ede2/ffmpeg.c/#L3078
d2a_code_trace_data_42842
int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, void *keyenc, void *keydec) { memcpy(dest, src, sizeof(OCB128_CONTEXT)); if (keyenc) dest->keyenc = keyenc; if (keydec) dest->keydec = keydec; if (src->l) { if ((dest->l = OPENSSL_malloc(src->max_l_index * 16)) == NULL) { CRYPTOerr(CRYPTO_F_CRYPTO_OCB128_COPY_CTX, ERR_R_MALLOC_FAILURE); return 0; } memcpy(dest->l, src->l, (src->l_index + 1) * 16); } return 1; } crypto/modes/ocb128.c:219: error: BUFFER_OVERRUN_S2 Offset added: [16⋅`src->l_index` + 16, 16⋅`src->l_index` + 16] Size: [1, 16⋅`src->max_l_index`]. Showing all 8 steps of the trace crypto/modes/ocb128.c:206:1: <Offset trace> 204. * Copy an OCB128_CONTEXT object 205. */ 206. > int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, 207. void *keyenc, void *keydec) 208. { crypto/modes/ocb128.c:206:1: Parameter `src->l_index` 204. * Copy an OCB128_CONTEXT object 205. */ 206. > int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, 207. void *keyenc, void *keydec) 208. { crypto/modes/ocb128.c:206:1: <Length trace> 204. * Copy an OCB128_CONTEXT object 205. */ 206. > int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, 207. void *keyenc, void *keydec) 208. { crypto/modes/ocb128.c:206:1: Parameter `src->max_l_index` 204. * Copy an OCB128_CONTEXT object 205. */ 206. > int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src, 207. void *keyenc, void *keydec) 208. { crypto/modes/ocb128.c:215:24: Call 213. dest->keydec = keydec; 214. if (src->l) { 215. if ((dest->l = OPENSSL_malloc(src->max_l_index * 16)) == NULL) { ^ 216. CRYPTOerr(CRYPTO_F_CRYPTO_OCB128_COPY_CTX, ERR_R_MALLOC_FAILURE); 217. return 0; crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/modes/ocb128.c:215:14: Assignment 213. dest->keydec = keydec; 214. if (src->l) { 215. if ((dest->l = OPENSSL_malloc(src->max_l_index * 16)) == NULL) { ^ 216. CRYPTOerr(CRYPTO_F_CRYPTO_OCB128_COPY_CTX, ERR_R_MALLOC_FAILURE); 217. return 0; crypto/modes/ocb128.c:219:9: Array access: Offset added: [16⋅src->l_index + 16, 16⋅src->l_index + 16] Size: [1, 16⋅src->max_l_index] 217. return 0; 218. } 219. memcpy(dest->l, src->l, (src->l_index + 1) * 16); ^ 220. } 221. return 1;
https://github.com/openssl/openssl/blob/7de2b9c4afd90359e47d81a5fa70bcb8506fbf91/crypto/modes/ocb128.c/#L219
d2a_code_trace_data_42843
static int dca_subsubframe(DCAContext * s) { int k, l; int subsubframe = s->current_subsubframe; const float *quant_step_table; float subband_samples[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][8]; if (s->bit_rate == 0x1f) quant_step_table = lossless_quant_d; else quant_step_table = lossy_quant_d; for (k = 0; k < s->prim_channels; k++) { for (l = 0; l < s->vq_start_subband[k]; l++) { int m; int abits = s->bitalloc[k][l]; float quant_step_size = quant_step_table[abits]; float rscale; int sel = s->quant_index_huffman[k][abits]; if(!abits){ memset(subband_samples[k][l], 0, 8 * sizeof(subband_samples[0][0][0])); }else if(abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table){ if(abits <= 7){ int block_code1, block_code2, size, levels; int block[8]; size = abits_sizes[abits-1]; levels = abits_levels[abits-1]; block_code1 = get_bits(&s->gb, size); decode_blockcode(block_code1, levels, block); block_code2 = get_bits(&s->gb, size); decode_blockcode(block_code2, levels, &block[4]); for (m = 0; m < 8; m++) subband_samples[k][l][m] = block[m]; }else{ for (m = 0; m < 8; m++) subband_samples[k][l][m] = get_sbits(&s->gb, abits - 3); } }else{ for (m = 0; m < 8; m++) subband_samples[k][l][m] = get_bitalloc(&s->gb, &dca_smpl_bitalloc[abits], sel); } if (s->transition_mode[k][l] && subsubframe >= s->transition_mode[k][l]) rscale = quant_step_size * s->scale_factor[k][l][1]; else rscale = quant_step_size * s->scale_factor[k][l][0]; rscale *= s->scalefactor_adj[k][sel]; for (m = 0; m < 8; m++) subband_samples[k][l][m] *= rscale; if (s->prediction_mode[k][l]) { int n; for (m = 0; m < 8; m++) { for (n = 1; n <= 4; n++) if (m >= n) subband_samples[k][l][m] += (adpcm_vb[s->prediction_vq[k][l]][n - 1] * subband_samples[k][l][m - n] / 8192); else if (s->predictor_history) subband_samples[k][l][m] += (adpcm_vb[s->prediction_vq[k][l]][n - 1] * s->subband_samples_hist[k][l][m - n + 4] / 8192); } } } for (l = s->vq_start_subband[k]; l < s->subband_activity[k]; l++) { int m; if (!s->debug_flag & 0x01) { av_log(s->avctx, AV_LOG_DEBUG, "Stream with high frequencies VQ coding\n"); s->debug_flag |= 0x01; } for (m = 0; m < 8; m++) { subband_samples[k][l][m] = high_freq_vq[s->high_freq_vq[k][l]][subsubframe * 8 + m] * (float) s->scale_factor[k][l][0] / 16.0; } } } if (s->aspf || subsubframe == s->subsubframes - 1) { if (0xFFFF == get_bits(&s->gb, 16)) { #ifdef TRACE av_log(s->avctx, AV_LOG_DEBUG, "Got subframe DSYNC\n"); #endif } else { av_log(s->avctx, AV_LOG_ERROR, "Didn't get subframe DSYNC\n"); } } for (k = 0; k < s->prim_channels; k++) for (l = 0; l < s->vq_start_subband[k]; l++) memcpy(s->subband_samples_hist[k][l], &subband_samples[k][l][4], 4 * sizeof(subband_samples[0][0][0])); for (k = 0; k < s->prim_channels; k++) { qmf_32_subbands(s, k, subband_samples[k], &s->samples[256 * k], 2.0 / 3 , 0 ); } if (s->prim_channels > dca_channels[s->output & DCA_CHANNEL_MASK]) { dca_downmix(s->samples, s->amode, s->downmix_coef); } if (s->output & DCA_LFE) { int lfe_samples = 2 * s->lfe * s->subsubframes; int i_channels = dca_channels[s->output & DCA_CHANNEL_MASK]; lfe_interpolation_fir(s->lfe, 2 * s->lfe, s->lfe_data + lfe_samples + 2 * s->lfe * subsubframe, &s->samples[256 * i_channels], 256.0, 0 ); } return 0; } libavcodec/dca.c:1006: error: Buffer Overrun L2 Offset: [0, 63] Size: 16. libavcodec/dca.c:848:1: <Offset trace> 846. static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 }; 847. 848. static int dca_subsubframe(DCAContext * s) ^ 849. { 850. int k, l; libavcodec/dca.c:848:1: Parameter `s->output` 846. static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 }; 847. 848. static int dca_subsubframe(DCAContext * s) ^ 849. { 850. int k, l; libavcodec/dcadata.h:50:1: <Length trace> 48. }; 49. 50. static const uint8_t dca_channels[16] = ^ 51. { 52. 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8 libavcodec/dcadata.h:50:1: Array declaration 48. }; 49. 50. static const uint8_t dca_channels[16] = ^ 51. { 52. 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8 libavcodec/dca.c:1006:26: Array access: Offset: [0, 63] Size: 16 1004. if (s->output & DCA_LFE) { 1005. int lfe_samples = 2 * s->lfe * s->subsubframes; 1006. int i_channels = dca_channels[s->output & DCA_CHANNEL_MASK]; ^ 1007. 1008. lfe_interpolation_fir(s->lfe, 2 * s->lfe,
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dca.c/#L1006
d2a_code_trace_data_42844
char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) { const X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; if (num > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_IA5STRING) { if (num > (int)sizeof(ebcdic_buf)) num = sizeof(ebcdic_buf); ascii2ebcdic(ebcdic_buf, q, num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (l > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); end: BUF_MEM_free(b); return (NULL); } test/ssltest_old.c:2962: error: BUFFER_OVERRUN_L2 Offset: [-oo, 1048576] Size: 256 by call to `X509_NAME_oneline`. Showing all 6 steps of the trace test/ssltest_old.c:2948:1: Array declaration 2946. } 2947. 2948. > static int app_verify_callback(X509_STORE_CTX *ctx, void *arg) 2949. { 2950. int ok = 1; test/ssltest_old.c:2962:17: Call 2960. (void *)ctx, (void *)c); 2961. if (c) 2962. s = X509_NAME_oneline(X509_get_subject_name(c), buf, 256); ^ 2963. if (s != NULL) { 2964. printf("cert depth=%d %s\n", crypto/x509/x509_obj.c:25:1: <Length trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `*buf` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:134:13: Assignment 132. break; 133. } else 134. p = &(buf[lold]); ^ 135. *(p++) = '/'; 136. memcpy(p, s, (unsigned int)l1); crypto/x509/x509_obj.c:135:9: Array access: Offset: [-oo, 1048576] Size: 256 by call to `X509_NAME_oneline` 133. } else 134. p = &(buf[lold]); 135. *(p++) = '/'; ^ 136. memcpy(p, s, (unsigned int)l1); 137. p += l1;
https://github.com/openssl/openssl/blob/cdb2a60347f988037d29adc7e4415e9c66c8a5a5/crypto/x509/x509_obj.c/#L135
d2a_code_trace_data_42845
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:692: error: Integer Overflow L2 ([-1, +oo] - 1):unsigned32 by call to `wv_get_value_float`. libavcodec/wavpack.c:648:1: Parameter `s->bc_extra_bits.bits_left` 646. } 647. 648. static inline int wv_unpack_mono(WavpackFrameContext *s, BitstreamContext *bc, ^ 649. void *dst, const int type) 650. { libavcodec/wavpack.c:692:24: Call 690. 691. if (type == AV_SAMPLE_FMT_FLTP) { 692. *dstfl++ = wv_get_value_float(s, &crc_extra_bits, S); ^ 693. } else if (type == AV_SAMPLE_FMT_S32P) { 694. *dst32++ = wv_get_value_integer(s, &crc_extra_bits, S); libavcodec/wavpack.c:435:1: Parameter `s->bc_extra_bits.bits_left` 433. } 434. 435. static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S) ^ 436. { 437. union { libavcodec/wavpack.c:491:17: Call 489. exp = 0; 490. if (s->got_extra_bits && (s->float_flag & WV_FLT_ZERO_SENT)) { 491. if (bitstream_read_bit(&s->bc_extra_bits)) { ^ 492. S = bitstream_read(&s->bc_extra_bits, 23); 493. if (s->float_max_exp >= 25) libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Assignment 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret; libavcodec/wavpack.c:498:28: Call 496. } else { 497. if (s->float_flag & WV_FLT_ZERO_SIGN) 498. sign = bitstream_read_bit(&s->bc_extra_bits); ^ 499. } 500. } libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([-1, +oo] - 1):unsigned32 by call to `wv_get_value_float` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139
d2a_code_trace_data_42846
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/ec/ecdh_kdf.c:93: error: USE_AFTER_FREE call to `EVP_DigestFinal()` eventually accesses memory that was invalidated by call to `free()` on line 81 indirectly during the call to `EVP_DigestInit_ex()`. Showing all 16 steps of the trace crypto/ec/ecdh_kdf.c:75:12: invalidation part of the trace starts here 73. || Zlen > ECDH_KDF_MAX) 74. return 0; 75. mctx = EVP_MD_CTX_new(); ^ 76. if (mctx == NULL) 77. return 0; crypto/ec/ecdh_kdf.c:75:12: passed as argument to `EVP_MD_CTX_new` 73. || Zlen > ECDH_KDF_MAX) 74. return 0; 75. mctx = EVP_MD_CTX_new(); ^ 76. if (mctx == NULL) 77. return 0; crypto/ec/ecdh_kdf.c:75:12: return from call to `EVP_MD_CTX_new` 73. || Zlen > ECDH_KDF_MAX) 74. return 0; 75. mctx = EVP_MD_CTX_new(); ^ 76. if (mctx == NULL) 77. return 0; crypto/ec/ecdh_kdf.c:75:5: assigned 73. || Zlen > ECDH_KDF_MAX) 74. return 0; 75. mctx = EVP_MD_CTX_new(); ^ 76. if (mctx == NULL) 77. return 0; crypto/ec/ecdh_kdf.c:81:9: when calling `EVP_DigestInit_ex` here 79. for (i = 1;; i++) { 80. unsigned char mtmp[EVP_MAX_MD_SIZE]; 81. EVP_DigestInit_ex(mctx, md, NULL); ^ 82. ctr[3] = i & 0xFF; 83. ctr[2] = (i >> 8) & 0xFF; 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/ec/ecdh_kdf.c:75:12: use-after-lifetime part of the trace starts here 73. || Zlen > ECDH_KDF_MAX) 74. return 0; 75. mctx = EVP_MD_CTX_new(); ^ 76. if (mctx == NULL) 77. return 0; crypto/ec/ecdh_kdf.c:75:12: passed as argument to `EVP_MD_CTX_new` 73. || Zlen > ECDH_KDF_MAX) 74. return 0; 75. mctx = EVP_MD_CTX_new(); ^ 76. if (mctx == NULL) 77. return 0; crypto/ec/ecdh_kdf.c:75:12: return from call to `EVP_MD_CTX_new` 73. || Zlen > ECDH_KDF_MAX) 74. return 0; 75. mctx = EVP_MD_CTX_new(); ^ 76. if (mctx == NULL) 77. return 0; crypto/ec/ecdh_kdf.c:75:5: assigned 73. || Zlen > ECDH_KDF_MAX) 74. return 0; 75. mctx = EVP_MD_CTX_new(); ^ 76. if (mctx == NULL) 77. return 0; crypto/ec/ecdh_kdf.c:93:18: when calling `EVP_DigestFinal` here 91. goto err; 92. if (outlen >= mdlen) { 93. if (!EVP_DigestFinal(mctx, out, NULL)) ^ 94. goto err; 95. outlen -= mdlen; 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_42847
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_srvr.c:3646: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->session_ctx->sessions->num_items`)] - 1):unsigned64 by call to `ssl3_send_alert`. Showing all 15 steps of the trace ssl/statem/statem_srvr.c:3638:1: Parameter `s->session_ctx->sessions->num_items` 3636. #endif 3637. 3638. > static int tls_construct_encrypted_extensions(SSL *s, WPACKET *pkt) 3639. { 3640. int al; ssl/statem/statem_srvr.c:3644:9: Call 3642. if (!tls_construct_extensions(s, pkt, SSL_EXT_TLS1_3_ENCRYPTED_EXTENSIONS, 3643. NULL, 0, &al)) { 3644. ssl3_send_alert(s, SSL3_AL_FATAL, al); ^ 3645. SSLerr(SSL_F_TLS_CONSTRUCT_ENCRYPTED_EXTENSIONS, ERR_R_INTERNAL_ERROR); 3646. ssl3_send_alert(s, SSL3_AL_FATAL, al); ssl/s3_msg.c:63:1: Parameter `s->session_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/statem/statem_srvr.c:3646:9: Call 3644. ssl3_send_alert(s, SSL3_AL_FATAL, al); 3645. SSLerr(SSL_F_TLS_CONSTRUCT_ENCRYPTED_EXTENSIONS, ERR_R_INTERNAL_ERROR); 3646. ssl3_send_alert(s, SSL3_AL_FATAL, al); ^ 3647. return 0; 3648. } ssl/s3_msg.c:63:1: Parameter `s->session_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:77:9: Call 75. /* If a fatal one, remove from cache */ 76. if ((level == SSL3_AL_FATAL) && (s->session != NULL)) 77. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 78. 79. s->s3->alert_dispatch = 1; ssl/ssl_sess.c:725:1: Parameter `ctx->sessions->num_items` 723. } 724. 725. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 726. { 727. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:727:12: Call 725. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 726. { 727. return remove_session_lock(ctx, c, 1); ^ 728. } 729. ssl/ssl_sess.c:730:1: Parameter `ctx->sessions->num_items` 728. } 729. 730. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 731. { 732. SSL_SESSION *r; ssl/ssl_sess.c:740:17: Call 738. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 739. ret = 1; 740. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 741. SSL_SESSION_list_remove(ctx, c); 742. } ssl/ssl_locl.h:689:1: Parameter `lh->num_items` 687. } CLIENTHELLO_MSG; 688. 689. > DEFINE_LHASH_OF(SSL_SESSION); 690. /* Needed in ssl_cert.c */ 691. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:689:1: Call 687. } CLIENTHELLO_MSG; 688. 689. > DEFINE_LHASH_OF(SSL_SESSION); 690. /* Needed in ssl_cert.c */ 691. 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->session_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/e128f891de71bbdba8391355af8d6d47d20b1969/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_42848
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_sp800_56b_check.c:63: error: INTEGER_OVERFLOW_L2 ([0, 9+max(0, `ctx->stack.depth`)] - 1):unsigned32 by call to `BN_mod_mul`. Showing all 45 steps of the trace crypto/rsa/rsa_sp800_56b_check.c:24:1: Parameter `ctx->stack.depth` 22. * 6.4.1.3.3: rsakpv2-crt Step 7 23. */ 24. > int rsa_check_crt_components(const RSA *rsa, BN_CTX *ctx) 25. { 26. int ret = 0; crypto/rsa/rsa_sp800_56b_check.c:36:5: Call 34. } 35. 36. BN_CTX_start(ctx); ^ 37. r = BN_CTX_get(ctx); 38. p1 = 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/rsa/rsa_sp800_56b_check.c:37:9: Call 35. 36. BN_CTX_start(ctx); 37. r = BN_CTX_get(ctx); ^ 38. p1 = BN_CTX_get(ctx); 39. q1 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/rsa/rsa_sp800_56b_check.c:38:10: Call 36. BN_CTX_start(ctx); 37. r = BN_CTX_get(ctx); 38. p1 = BN_CTX_get(ctx); ^ 39. q1 = BN_CTX_get(ctx); 40. ret = (q1 != NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/rsa/rsa_sp800_56b_check.c:39:10: Call 37. r = BN_CTX_get(ctx); 38. p1 = BN_CTX_get(ctx); 39. q1 = BN_CTX_get(ctx); ^ 40. ret = (q1 != NULL) 41. /* p1 = p -1 */ crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/rsa/rsa_sp800_56b_check.c:57:14: Call 55. && (BN_cmp(rsa->iqmp, rsa->p) < 0) 56. /* (d) 1 = (dP . e) mod (p - 1)*/ 57. && BN_mod_mul(r, rsa->dmp1, rsa->e, p1, ctx) ^ 58. && BN_is_one(r) 59. /* (e) 1 = (dQ . e) mod (q - 1) */ crypto/bn/bn_mod.c:193:1: Parameter `ctx->stack.depth` 191. 192. /* slow but works */ 193. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 194. BN_CTX *ctx) 195. { crypto/bn/bn_mod.c:203:5: Call 201. bn_check_top(m); 202. 203. BN_CTX_start(ctx); ^ 204. if ((t = BN_CTX_get(ctx)) == NULL) 205. goto err; 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_mod.c:204:14: Call 202. 203. BN_CTX_start(ctx); 204. if ((t = BN_CTX_get(ctx)) == NULL) ^ 205. goto err; 206. if (a == b) { crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mod.c:218:5: Call 216. ret = 1; 217. err: 218. BN_CTX_end(ctx); ^ 219. return ret; 220. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/rsa/rsa_sp800_56b_check.c:60:14: Call 58. && BN_is_one(r) 59. /* (e) 1 = (dQ . e) mod (q - 1) */ 60. && BN_mod_mul(r, rsa->dmq1, rsa->e, q1, ctx) ^ 61. && BN_is_one(r) 62. /* (f) 1 = (qInv . q) mod p */ crypto/bn/bn_mod.c:193:1: Parameter `ctx->stack.depth` 191. 192. /* slow but works */ 193. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 194. BN_CTX *ctx) 195. { crypto/bn/bn_mod.c:203:5: Call 201. bn_check_top(m); 202. 203. BN_CTX_start(ctx); ^ 204. if ((t = BN_CTX_get(ctx)) == NULL) 205. goto err; 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_mod.c:204:14: Call 202. 203. BN_CTX_start(ctx); 204. if ((t = BN_CTX_get(ctx)) == NULL) ^ 205. goto err; 206. if (a == b) { crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mod.c:218:5: Call 216. ret = 1; 217. err: 218. BN_CTX_end(ctx); ^ 219. return ret; 220. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/rsa/rsa_sp800_56b_check.c:63:14: Call 61. && BN_is_one(r) 62. /* (f) 1 = (qInv . q) mod p */ 63. && BN_mod_mul(r, rsa->iqmp, rsa->q, rsa->p, ctx) ^ 64. && BN_is_one(r); 65. BN_clear(p1); crypto/bn/bn_mod.c:193:1: Parameter `ctx->stack.depth` 191. 192. /* slow but works */ 193. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 194. BN_CTX *ctx) 195. { crypto/bn/bn_mod.c:203:5: Call 201. bn_check_top(m); 202. 203. BN_CTX_start(ctx); ^ 204. if ((t = BN_CTX_get(ctx)) == NULL) 205. goto err; 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_mod.c:204:14: Call 202. 203. BN_CTX_start(ctx); 204. if ((t = BN_CTX_get(ctx)) == NULL) ^ 205. goto err; 206. if (a == b) { crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mod.c:207:14: Call 205. goto err; 206. if (a == b) { 207. if (!BN_sqr(t, a, ctx)) ^ 208. goto err; 209. } else { 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:27:1: Parameter `ctx->stack.depth` 25. } 26. 27. > int bn_sqr_fixed_top(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 28. { 29. int max, al; 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.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_sqr.c:44:11: Call 42. BN_CTX_start(ctx); 43. rr = (a != r) ? r : BN_CTX_get(ctx); 44. tmp = BN_CTX_get(ctx); ^ 45. if (rr == NULL || tmp == NULL) 46. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_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.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, 9+max(0, ctx->stack.depth)] - 1):unsigned32 by call to `BN_mod_mul` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_42849
static void opt_output_file(void *optctx, const char *filename) { OptionsContext *o = optctx; AVFormatContext *oc; int i, err; AVOutputFormat *file_oformat; OutputStream *ost; InputStream *ist; if (!strcmp(filename, "-")) filename = "pipe:"; oc = avformat_alloc_context(); if (!oc) { print_error(filename, AVERROR(ENOMEM)); exit_program(1); } if (o->format) { file_oformat = av_guess_format(o->format, NULL, NULL); if (!file_oformat) { av_log(NULL, AV_LOG_FATAL, "Requested output format '%s' is not a suitable output format\n", o->format); exit_program(1); } } else { file_oformat = av_guess_format(NULL, filename, NULL); if (!file_oformat) { av_log(NULL, AV_LOG_FATAL, "Unable to find a suitable output format for '%s'\n", filename); exit_program(1); } } oc->oformat = file_oformat; oc->interrupt_callback = int_cb; av_strlcpy(oc->filename, filename, sizeof(oc->filename)); if (!o->nb_stream_maps) { #define NEW_STREAM(type, index)\ if (index >= 0) {\ ost = new_ ## type ## _stream(o, oc);\ ost->source_index = index;\ ost->sync_ist = &input_streams[index];\ input_streams[index].discard = 0;\ } if (!o->video_disable && oc->oformat->video_codec != CODEC_ID_NONE) { int area = 0, idx = -1; for (i = 0; i < nb_input_streams; i++) { ist = &input_streams[i]; if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ist->st->codec->width * ist->st->codec->height > area) { area = ist->st->codec->width * ist->st->codec->height; idx = i; } } NEW_STREAM(video, idx); } if (!o->audio_disable && oc->oformat->audio_codec != CODEC_ID_NONE) { int channels = 0, idx = -1; for (i = 0; i < nb_input_streams; i++) { ist = &input_streams[i]; if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && ist->st->codec->channels > channels) { channels = ist->st->codec->channels; idx = i; } } NEW_STREAM(audio, idx); } if (!o->subtitle_disable && oc->oformat->subtitle_codec != CODEC_ID_NONE) { for (i = 0; i < nb_input_streams; i++) if (input_streams[i].st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) { NEW_STREAM(subtitle, i); break; } } } else { for (i = 0; i < o->nb_stream_maps; i++) { StreamMap *map = &o->stream_maps[i]; if (map->disabled) continue; ist = &input_streams[input_files[map->file_index].ist_index + map->stream_index]; switch (ist->st->codec->codec_type) { case AVMEDIA_TYPE_VIDEO: ost = new_video_stream(o, oc); break; case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream(o, oc); break; case AVMEDIA_TYPE_SUBTITLE: ost = new_subtitle_stream(o, oc); break; case AVMEDIA_TYPE_DATA: ost = new_data_stream(o, oc); break; case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc); break; default: av_log(NULL, AV_LOG_FATAL, "Cannot map stream #%d:%d - unsupported type.\n", map->file_index, map->stream_index); exit_program(1); } ost->source_index = input_files[map->file_index].ist_index + map->stream_index; ost->sync_ist = &input_streams[input_files[map->sync_file_index].ist_index + map->sync_stream_index]; ist->discard = 0; } } for (i = 0; i < o->nb_attachments; i++) { AVIOContext *pb; uint8_t *attachment; const char *p; int64_t len; if ((err = avio_open2(&pb, o->attachments[i], AVIO_FLAG_READ, &int_cb, NULL)) < 0) { av_log(NULL, AV_LOG_FATAL, "Could not open attachment file %s.\n", o->attachments[i]); exit_program(1); } if ((len = avio_size(pb)) <= 0) { av_log(NULL, AV_LOG_FATAL, "Could not get size of the attachment %s.\n", o->attachments[i]); exit_program(1); } if (!(attachment = av_malloc(len))) { av_log(NULL, AV_LOG_FATAL, "Attachment %s too large to fit into memory.\n", o->attachments[i]); exit_program(1); } avio_read(pb, attachment, len); ost = new_attachment_stream(o, oc); ost->stream_copy = 0; ost->source_index = -1; ost->attachment_filename = o->attachments[i]; ost->st->codec->extradata = attachment; ost->st->codec->extradata_size = len; p = strrchr(o->attachments[i], '/'); av_dict_set(&ost->st->metadata, "filename", (p && *p) ? p + 1 : o->attachments[i], AV_DICT_DONT_OVERWRITE); avio_close(pb); } output_files = grow_array(output_files, sizeof(*output_files), &nb_output_files, nb_output_files + 1); output_files[nb_output_files - 1].ctx = oc; output_files[nb_output_files - 1].ost_index = nb_output_streams - oc->nb_streams; output_files[nb_output_files - 1].recording_time = o->recording_time; output_files[nb_output_files - 1].start_time = o->start_time; output_files[nb_output_files - 1].limit_filesize = o->limit_filesize; av_dict_copy(&output_files[nb_output_files - 1].opts, format_opts, 0); if (oc->oformat->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(oc->filename)) { print_error(oc->filename, AVERROR(EINVAL)); exit_program(1); } } if (!(oc->oformat->flags & AVFMT_NOFILE)) { assert_file_overwrite(filename); if ((err = avio_open2(&oc->pb, filename, AVIO_FLAG_WRITE, &oc->interrupt_callback, &output_files[nb_output_files - 1].opts)) < 0) { print_error(filename, err); exit_program(1); } } if (o->mux_preload) { uint8_t buf[64]; snprintf(buf, sizeof(buf), "%d", (int)(o->mux_preload*AV_TIME_BASE)); av_dict_set(&output_files[nb_output_files - 1].opts, "preload", buf, 0); } oc->max_delay = (int)(o->mux_max_delay * AV_TIME_BASE); oc->flags |= AVFMT_FLAG_NONBLOCK; for (i = 0; i < o->nb_metadata_map; i++) { char *p; int in_file_index = strtol(o->metadata_map[i].u.str, &p, 0); if (in_file_index < 0) continue; if (in_file_index >= nb_input_files) { av_log(NULL, AV_LOG_FATAL, "Invalid input file index %d while processing metadata maps\n", in_file_index); exit_program(1); } copy_metadata(o->metadata_map[i].specifier, *p ? p + 1 : p, oc, input_files[in_file_index].ctx, o); } if (o->chapters_input_file >= nb_input_files) { if (o->chapters_input_file == INT_MAX) { o->chapters_input_file = -1; for (i = 0; i < nb_input_files; i++) if (input_files[i].ctx->nb_chapters) { o->chapters_input_file = i; break; } } else { av_log(NULL, AV_LOG_FATAL, "Invalid input file index %d in chapter mapping.\n", o->chapters_input_file); exit_program(1); } } if (o->chapters_input_file >= 0) copy_chapters(&input_files[o->chapters_input_file], &output_files[nb_output_files - 1], !o->metadata_chapters_manual); if (!o->metadata_global_manual && nb_input_files) av_dict_copy(&oc->metadata, input_files[0].ctx->metadata, AV_DICT_DONT_OVERWRITE); if (!o->metadata_streams_manual) for (i = output_files[nb_output_files - 1].ost_index; i < nb_output_streams; i++) { InputStream *ist; if (output_streams[i].source_index < 0) continue; ist = &input_streams[output_streams[i].source_index]; av_dict_copy(&output_streams[i].st->metadata, ist->st->metadata, AV_DICT_DONT_OVERWRITE); } for (i = 0; i < o->nb_metadata; i++) { AVDictionary **m; char type, *val; const char *stream_spec; int index = 0, j, ret; val = strchr(o->metadata[i].u.str, '='); if (!val) { av_log(NULL, AV_LOG_FATAL, "No '=' character in metadata string %s.\n", o->metadata[i].u.str); exit_program(1); } *val++ = 0; parse_meta_type(o->metadata[i].specifier, &type, &index, &stream_spec); if (type == 's') { for (j = 0; j < oc->nb_streams; j++) { if ((ret = check_stream_specifier(oc, oc->streams[j], stream_spec)) > 0) { av_dict_set(&oc->streams[j]->metadata, o->metadata[i].u.str, *val ? val : NULL, 0); } else if (ret < 0) exit_program(1); } printf("ret %d, stream_spec %s\n", ret, stream_spec); } else { switch (type) { case 'g': m = &oc->metadata; break; case 'c': if (index < 0 || index >= oc->nb_chapters) { av_log(NULL, AV_LOG_FATAL, "Invalid chapter index %d in metadata specifier.\n", index); exit_program(1); } m = &oc->chapters[index]->metadata; break; default: av_log(NULL, AV_LOG_FATAL, "Invalid metadata specifier %s.\n", o->metadata[i].specifier); exit_program(1); } av_dict_set(m, o->metadata[i].u.str, *val ? val : NULL, 0); } } reset_options(o); } avconv.c:3812: error: Null Dereference pointer `oc` last assigned on line 3791 could be null and is dereferenced at line 3812, column 5. avconv.c:3779:1: start of procedure opt_output_file() 3777. } 3778. 3779. static void opt_output_file(void *optctx, const char *filename) ^ 3780. { 3781. OptionsContext *o = optctx; avconv.c:3781:5: 3779. static void opt_output_file(void *optctx, const char *filename) 3780. { 3781. OptionsContext *o = optctx; ^ 3782. AVFormatContext *oc; 3783. int i, err; avconv.c:3788:10: Taking true branch 3786. InputStream *ist; 3787. 3788. if (!strcmp(filename, "-")) ^ 3789. filename = "pipe:"; 3790. avconv.c:3789:9: 3787. 3788. if (!strcmp(filename, "-")) 3789. filename = "pipe:"; ^ 3790. 3791. oc = avformat_alloc_context(); avconv.c:3791:5: 3789. filename = "pipe:"; 3790. 3791. oc = avformat_alloc_context(); ^ 3792. if (!oc) { 3793. print_error(filename, AVERROR(ENOMEM)); libavformat/options.c:141:1: start of procedure avformat_alloc_context() 139. } 140. 141. AVFormatContext *avformat_alloc_context(void) ^ 142. { 143. AVFormatContext *ic; libavformat/options.c:144:5: 142. { 143. AVFormatContext *ic; 144. ic = av_malloc(sizeof(AVFormatContext)); ^ 145. if (!ic) return ic; 146. 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(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 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,32,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:114:5: 112. ptr = malloc(size); 113. #endif 114. return ptr; ^ 115. } 116. libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavformat/options.c:145:10: Taking true branch 143. AVFormatContext *ic; 144. ic = av_malloc(sizeof(AVFormatContext)); 145. if (!ic) return ic; ^ 146. avformat_get_context_defaults(ic); 147. return ic; libavformat/options.c:145:14: 143. AVFormatContext *ic; 144. ic = av_malloc(sizeof(AVFormatContext)); 145. if (!ic) return ic; ^ 146. avformat_get_context_defaults(ic); 147. return ic; libavformat/options.c:148:1: return from a call to avformat_alloc_context 146. avformat_get_context_defaults(ic); 147. return ic; 148. } ^ 149. 150. const AVClass *avformat_get_class(void) avconv.c:3792:10: Taking true branch 3790. 3791. oc = avformat_alloc_context(); 3792. if (!oc) { ^ 3793. print_error(filename, AVERROR(ENOMEM)); 3794. exit_program(1); avconv.c:3793:9: 3791. oc = avformat_alloc_context(); 3792. if (!oc) { 3793. print_error(filename, AVERROR(ENOMEM)); ^ 3794. exit_program(1); 3795. } cmdutils.c:450:1: start of procedure print_error() 448. } 449. 450. void print_error(const char *filename, int err) ^ 451. { 452. char errbuf[128]; cmdutils.c:453:5: 451. { 452. char errbuf[128]; 453. const char *errbuf_ptr = errbuf; ^ 454. 455. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) cmdutils.c:455:9: Taking true branch 453. const char *errbuf_ptr = errbuf; 454. 455. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) ^ 456. errbuf_ptr = strerror(AVUNERROR(err)); 457. av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr); cmdutils.c:456:9: Skipping strerror(): method has no implementation 454. 455. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) 456. errbuf_ptr = strerror(AVUNERROR(err)); ^ 457. av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr); 458. } cmdutils.c:457:5: Skipping av_log(): empty list of specs 455. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) 456. errbuf_ptr = strerror(AVUNERROR(err)); 457. av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr); ^ 458. } 459. cmdutils.c:458:1: return from a call to print_error 456. errbuf_ptr = strerror(AVUNERROR(err)); 457. av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr); 458. } ^ 459. 460. static int warned_cfg = 0; avconv.c:3794:9: Skipping exit_program(): empty list of specs 3792. if (!oc) { 3793. print_error(filename, AVERROR(ENOMEM)); 3794. exit_program(1); ^ 3795. } 3796. avconv.c:3797:9: Taking true branch 3795. } 3796. 3797. if (o->format) { ^ 3798. file_oformat = av_guess_format(o->format, NULL, NULL); 3799. if (!file_oformat) { avconv.c:3798:9: Skipping av_guess_format(): empty list of specs 3796. 3797. if (o->format) { 3798. file_oformat = av_guess_format(o->format, NULL, NULL); ^ 3799. if (!file_oformat) { 3800. av_log(NULL, AV_LOG_FATAL, "Requested output format '%s' is not a suitable output format\n", o->format); avconv.c:3799:14: Taking false branch 3797. if (o->format) { 3798. file_oformat = av_guess_format(o->format, NULL, NULL); 3799. if (!file_oformat) { ^ 3800. av_log(NULL, AV_LOG_FATAL, "Requested output format '%s' is not a suitable output format\n", o->format); 3801. exit_program(1); avconv.c:3812:5: 3810. } 3811. 3812. oc->oformat = file_oformat; ^ 3813. oc->interrupt_callback = int_cb; 3814. av_strlcpy(oc->filename, filename, sizeof(oc->filename));
https://github.com/libav/libav/blob/e1e369049e3d2f88eed6ed38eb3dd704681c7f1a/avconv.c/#L3812
d2a_code_trace_data_42850
static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt) { #ifndef OPENSSL_NO_RSA unsigned char *encdata = NULL; EVP_PKEY *pkey = NULL; EVP_PKEY_CTX *pctx = NULL; size_t enclen; unsigned char *pms = NULL; size_t pmslen = 0; if (s->session->peer == NULL) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); return 0; } pkey = X509_get0_pubkey(s->session->peer); if (EVP_PKEY_get0_RSA(pkey) == NULL) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); return 0; } pmslen = SSL_MAX_MASTER_KEY_LENGTH; pms = OPENSSL_malloc(pmslen); if (pms == NULL) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE); return 0; } pms[0] = s->client_version >> 8; pms[1] = s->client_version & 0xff; if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE); goto err; } if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); goto err; } pctx = EVP_PKEY_CTX_new(pkey, NULL); if (pctx == NULL || EVP_PKEY_encrypt_init(pctx) <= 0 || EVP_PKEY_encrypt(pctx, NULL, &enclen, pms, pmslen) <= 0) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_EVP_LIB); goto err; } if (!WPACKET_allocate_bytes(pkt, enclen, &encdata) || EVP_PKEY_encrypt(pctx, encdata, &enclen, pms, pmslen) <= 0) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, SSL_R_BAD_RSA_ENCRYPT); goto err; } EVP_PKEY_CTX_free(pctx); pctx = NULL; if (s->version > SSL3_VERSION && !WPACKET_close(pkt)) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); goto err; } if (!ssl_log_rsa_client_key_exchange(s, encdata, enclen, pms, pmslen)) { goto err; } s->s3->tmp.pms = pms; s->s3->tmp.pmslen = pmslen; return 1; err: OPENSSL_clear_free(pms, pmslen); EVP_PKEY_CTX_free(pctx); return 0; #else SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); return 0; #endif } ssl/statem/statem_clnt.c:2981: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_malloc()` at line 2925, column 11 is not reachable after line 2981, column 5. Showing all 61 steps of the trace ssl/statem/statem_clnt.c:2898:1: start of procedure tls_construct_cke_rsa() 2896. } 2897. 2898. > static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt) 2899. { 2900. #ifndef OPENSSL_NO_RSA ssl/statem/statem_clnt.c:2901:5: 2899. { 2900. #ifndef OPENSSL_NO_RSA 2901. > unsigned char *encdata = NULL; 2902. EVP_PKEY *pkey = NULL; 2903. EVP_PKEY_CTX *pctx = NULL; ssl/statem/statem_clnt.c:2902:5: 2900. #ifndef OPENSSL_NO_RSA 2901. unsigned char *encdata = NULL; 2902. > EVP_PKEY *pkey = NULL; 2903. EVP_PKEY_CTX *pctx = NULL; 2904. size_t enclen; ssl/statem/statem_clnt.c:2903:5: 2901. unsigned char *encdata = NULL; 2902. EVP_PKEY *pkey = NULL; 2903. > EVP_PKEY_CTX *pctx = NULL; 2904. size_t enclen; 2905. unsigned char *pms = NULL; ssl/statem/statem_clnt.c:2905:5: 2903. EVP_PKEY_CTX *pctx = NULL; 2904. size_t enclen; 2905. > unsigned char *pms = NULL; 2906. size_t pmslen = 0; 2907. ssl/statem/statem_clnt.c:2906:5: 2904. size_t enclen; 2905. unsigned char *pms = NULL; 2906. > size_t pmslen = 0; 2907. 2908. if (s->session->peer == NULL) { ssl/statem/statem_clnt.c:2908:9: Taking false branch 2906. size_t pmslen = 0; 2907. 2908. if (s->session->peer == NULL) { ^ 2909. /* 2910. * We should always have a server certificate with SSL_kRSA. ssl/statem/statem_clnt.c:2917:5: 2915. } 2916. 2917. > pkey = X509_get0_pubkey(s->session->peer); 2918. if (EVP_PKEY_get0_RSA(pkey) == NULL) { 2919. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, crypto/x509/x509_cmp.c:264:1: start of procedure X509_get0_pubkey() 262. } 263. 264. > EVP_PKEY *X509_get0_pubkey(const X509 *x) 265. { 266. if (x == NULL) crypto/x509/x509_cmp.c:266:9: Taking false branch 264. EVP_PKEY *X509_get0_pubkey(const X509 *x) 265. { 266. if (x == NULL) ^ 267. return NULL; 268. return X509_PUBKEY_get0(x->cert_info.key); crypto/x509/x509_cmp.c:268:5: 266. if (x == NULL) 267. return NULL; 268. > return X509_PUBKEY_get0(x->cert_info.key); 269. } 270. crypto/x509/x_pubkey.c:140:1: start of procedure X509_PUBKEY_get0() 138. } 139. 140. > EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) 141. { 142. EVP_PKEY *ret = NULL; crypto/x509/x_pubkey.c:142:5: 140. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) 141. { 142. > EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) crypto/x509/x_pubkey.c:144:9: Taking false branch 142. EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) ^ 145. return NULL; 146. crypto/x509/x_pubkey.c:144:24: Taking false branch 142. EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) ^ 145. return NULL; 146. crypto/x509/x_pubkey.c:147:9: Taking true branch 145. return NULL; 146. 147. if (key->pkey != NULL) ^ 148. return key->pkey; 149. crypto/x509/x_pubkey.c:148:9: 146. 147. if (key->pkey != NULL) 148. > return key->pkey; 149. 150. /* crypto/x509/x_pubkey.c:166:1: return from a call to X509_PUBKEY_get0 164. 165. return NULL; 166. > } 167. 168. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) crypto/x509/x509_cmp.c:269:1: return from a call to X509_get0_pubkey 267. return NULL; 268. return X509_PUBKEY_get0(x->cert_info.key); 269. > } 270. 271. EVP_PKEY *X509_get_pubkey(X509 *x) ssl/statem/statem_clnt.c:2918:9: 2916. 2917. pkey = X509_get0_pubkey(s->session->peer); 2918. > if (EVP_PKEY_get0_RSA(pkey) == NULL) { 2919. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 2920. ERR_R_INTERNAL_ERROR); crypto/evp/p_lib.c:407:1: start of procedure EVP_PKEY_get0_RSA() 405. } 406. 407. > RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey) 408. { 409. if (pkey->type != EVP_PKEY_RSA) { crypto/evp/p_lib.c:409:9: Taking false branch 407. RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey) 408. { 409. if (pkey->type != EVP_PKEY_RSA) { ^ 410. EVPerr(EVP_F_EVP_PKEY_GET0_RSA, EVP_R_EXPECTING_AN_RSA_KEY); 411. return NULL; crypto/evp/p_lib.c:413:5: 411. return NULL; 412. } 413. > return pkey->pkey.rsa; 414. } 415. crypto/evp/p_lib.c:414:1: return from a call to EVP_PKEY_get0_RSA 412. } 413. return pkey->pkey.rsa; 414. > } 415. 416. RSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey) ssl/statem/statem_clnt.c:2918:9: Taking false branch 2916. 2917. pkey = X509_get0_pubkey(s->session->peer); 2918. if (EVP_PKEY_get0_RSA(pkey) == NULL) { ^ 2919. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 2920. ERR_R_INTERNAL_ERROR); ssl/statem/statem_clnt.c:2924:5: 2922. } 2923. 2924. > pmslen = SSL_MAX_MASTER_KEY_LENGTH; 2925. pms = OPENSSL_malloc(pmslen); 2926. if (pms == NULL) { ssl/statem/statem_clnt.c:2925:5: 2923. 2924. pmslen = SSL_MAX_MASTER_KEY_LENGTH; 2925. > pms = OPENSSL_malloc(pmslen); 2926. if (pms == NULL) { 2927. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 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) ssl/statem/statem_clnt.c:2926:9: Taking false branch 2924. pmslen = SSL_MAX_MASTER_KEY_LENGTH; 2925. pms = OPENSSL_malloc(pmslen); 2926. if (pms == NULL) { ^ 2927. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 2928. ERR_R_MALLOC_FAILURE); ssl/statem/statem_clnt.c:2932:5: 2930. } 2931. 2932. > pms[0] = s->client_version >> 8; 2933. pms[1] = s->client_version & 0xff; 2934. /* TODO(size_t): Convert this function */ ssl/statem/statem_clnt.c:2933:5: 2931. 2932. pms[0] = s->client_version >> 8; 2933. > pms[1] = s->client_version & 0xff; 2934. /* TODO(size_t): Convert this function */ 2935. if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) { ssl/statem/statem_clnt.c:2935:9: Taking false branch 2933. pms[1] = s->client_version & 0xff; 2934. /* TODO(size_t): Convert this function */ 2935. if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) { ^ 2936. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 2937. ERR_R_MALLOC_FAILURE); ssl/statem/statem_clnt.c:2942:9: Taking true branch 2940. 2941. /* Fix buf for TLS and beyond */ 2942. if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) { ^ 2943. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 2944. ERR_R_INTERNAL_ERROR); ssl/statem/statem_clnt.c:2942:39: Taking true branch 2940. 2941. /* Fix buf for TLS and beyond */ 2942. if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) { ^ 2943. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 2944. ERR_R_INTERNAL_ERROR); ssl/statem/statem_clnt.c:2943:9: 2941. /* Fix buf for TLS and beyond */ 2942. if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) { 2943. > SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 2944. ERR_R_INTERNAL_ERROR); 2945. goto err; test/tls13secretstest.c:210:1: start of procedure ossl_statem_fatal() 208. } 209. 210. > void ossl_statem_fatal(SSL *s, int al, int func, int reason, const char *file, 211. int line) 212. { test/tls13secretstest.c:213:1: return from a call to ossl_statem_fatal 211. int line) 212. { 213. > } 214. 215. int ossl_statem_export_allowed(SSL *s) ssl/statem/statem_clnt.c:2980:2: 2978. 2979. return 1; 2980. > err: 2981. OPENSSL_clear_free(pms, pmslen); 2982. EVP_PKEY_CTX_free(pctx); ssl/statem/statem_clnt.c:2981:5: 2979. return 1; 2980. err: 2981. > OPENSSL_clear_free(pms, pmslen); 2982. EVP_PKEY_CTX_free(pctx); 2983. crypto/mem.c:316:1: start of procedure CRYPTO_clear_free() 314. } 315. 316. > void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) 317. { 318. if (str == NULL) crypto/mem.c:318:9: Taking false branch 316. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) 317. { 318. if (str == NULL) ^ 319. return; 320. if (num) crypto/mem.c:320:9: Taking true branch 318. if (str == NULL) 319. return; 320. if (num) ^ 321. OPENSSL_cleanse(str, num); 322. CRYPTO_free(str, file, line); crypto/mem.c:321:9: Skipping OPENSSL_cleanse(): method has no implementation 319. return; 320. if (num) 321. OPENSSL_cleanse(str, num); ^ 322. CRYPTO_free(str, file, line); 323. } crypto/mem.c:322:5: 320. if (num) 321. OPENSSL_cleanse(str, num); 322. > CRYPTO_free(str, file, line); 323. } 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/mem.c:323:1: return from a call to CRYPTO_clear_free 321. OPENSSL_cleanse(str, num); 322. CRYPTO_free(str, file, line); 323. > }
https://github.com/openssl/openssl/blob/c22365b399f62af4a81e9202500cd2cbd9c23a9d/ssl/statem/statem_clnt.c/#L2981
d2a_code_trace_data_42851
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:3105: error: Null Dereference pointer `codec` last assigned on line 3098 could be null and is dereferenced at line 3105, column 8. ffmpeg.c:3091:1: start of procedure find_codec_or_die() 3089. } 3090. 3091. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) ^ 3092. { 3093. const char *codec_string = encoder ? "encoder" : "decoder"; ffmpeg.c:3093:32: Condition is true 3091. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) 3092. { 3093. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 3094. AVCodec *codec; 3095. ffmpeg.c:3093:5: 3091. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) 3092. { 3093. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 3094. AVCodec *codec; 3095. ffmpeg.c:3096:9: Taking false branch 3094. AVCodec *codec; 3095. 3096. if(!name) ^ 3097. return CODEC_ID_NONE; 3098. codec = encoder ? ffmpeg.c:3098:13: Condition is true 3096. if(!name) 3097. return CODEC_ID_NONE; 3098. codec = encoder ? ^ 3099. avcodec_find_encoder_by_name(name) : 3100. avcodec_find_decoder_by_name(name); ffmpeg.c:3098:5: 3096. if(!name) 3097. return CODEC_ID_NONE; 3098. codec = encoder ? ^ 3099. avcodec_find_encoder_by_name(name) : 3100. avcodec_find_decoder_by_name(name); ffmpeg.c:3101:9: Taking true branch 3099. avcodec_find_encoder_by_name(name) : 3100. avcodec_find_decoder_by_name(name); 3101. if(!codec) { ^ 3102. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); 3103. ffmpeg_exit(1); ffmpeg.c:3102:9: 3100. avcodec_find_decoder_by_name(name); 3101. if(!codec) { 3102. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); ^ 3103. ffmpeg_exit(1); 3104. } ffmpeg.c:3103:9: Skipping ffmpeg_exit(): empty list of specs 3101. if(!codec) { 3102. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); 3103. ffmpeg_exit(1); ^ 3104. } 3105. if(codec->type != type) { ffmpeg.c:3105:8: 3103. ffmpeg_exit(1); 3104. } 3105. if(codec->type != type) { ^ 3106. fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name); 3107. ffmpeg_exit(1);
https://github.com/libav/libav/blob/2d777bb7a20041ac0564ffef85bf40619af8ccd1/ffmpeg.c/#L3105
d2a_code_trace_data_42852
static av_always_inline int epzs_motion_search_internal(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, int flags, int size, int h) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d; int dmin; int map_generation; int penalty_factor; 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 LOAD_COMMON2 if(c->pre_pass){ penalty_factor= c->pre_penalty_factor; cmpf= s->dsp.me_pre_cmp[size]; chroma_cmpf= s->dsp.me_pre_cmp[size+1]; }else{ penalty_factor= c->penalty_factor; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; } map_generation= update_map_generation(c); assert(cmpf); dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags); map[0]= map_generation; score_map[0]= dmin; if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0) dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor; 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) }else{ if(dmin<((h*h*s->avctx->mv0_threshold)>>8) && ( P_LEFT[0] |P_LEFT[1] |P_TOP[0] |P_TOP[1] |P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){ *mx_ptr= 0; *my_ptr= 0; c->skip=1; return dmin; } CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[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_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) } if(dmin>h*h*4){ if(c->pre_pass){ 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->first_slice_line) 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) }else{ 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) } } if(c->avctx->last_predictor_count){ const int count= c->avctx->last_predictor_count; const int xstart= FFMAX(0, s->mb_x - count); const int ystart= FFMAX(0, s->mb_y - count); const int xend= FFMIN(s->mb_width , s->mb_x + count + 1); const int yend= FFMIN(s->mb_height, s->mb_y + count + 1); int mb_y; for(mb_y=ystart; mb_y<yend; mb_y++){ int mb_x; for(mb_x=xstart; mb_x<xend; mb_x++){ const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride; int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16; int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16; if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; CHECK_MV(mx,my) } } } 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:1098: error: Uninitialized Value The value read from xmin was never initialized. libavcodec/motion_est_template.c:1098:31: 1096. int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16; 1097. 1098. if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; ^ 1099. CHECK_MV(mx,my) 1100. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1098
d2a_code_trace_data_42853
static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; GetBitContext gb; HuffContext h[4]; VLC vlc[4]; int16_t *samples = data; int8_t *samples8 = data; int val; int i, res; int unp_size; int bits, stereo; int pred[2] = {0, 0}; unp_size = AV_RL32(buf); init_get_bits(&gb, buf + 4, (buf_size - 4) * 8); if(!get_bits1(&gb)){ av_log(avctx, AV_LOG_INFO, "Sound: no data\n"); *data_size = 0; return 1; } stereo = get_bits1(&gb); bits = get_bits1(&gb); if (unp_size & 0xC0000000 || unp_size > *data_size) { av_log(avctx, AV_LOG_ERROR, "Frame is too large to fit in buffer\n"); return -1; } memset(vlc, 0, sizeof(VLC) * 4); memset(h, 0, sizeof(HuffContext) * 4); for(i = 0; i < (1 << (bits + stereo)); i++) { h[i].length = 256; h[i].maxlength = 0; h[i].current = 0; h[i].bits = av_mallocz(256 * 4); h[i].lengths = av_mallocz(256 * sizeof(int)); h[i].values = av_mallocz(256 * sizeof(int)); skip_bits1(&gb); smacker_decode_tree(&gb, &h[i], 0, 0); skip_bits1(&gb); if(h[i].current > 1) { res = init_vlc(&vlc[i], SMKTREE_BITS, h[i].length, h[i].lengths, sizeof(int), sizeof(int), h[i].bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE); if(res < 0) { av_log(avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); return -1; } } } if(bits) { for(i = stereo; i >= 0; i--) pred[i] = av_bswap16(get_bits(&gb, 16)); for(i = 0; i <= stereo; i++) *samples++ = pred[i]; for(; i < unp_size / 2; i++) { if(i & stereo) { if(vlc[2].table) res = get_vlc2(&gb, vlc[2].table, SMKTREE_BITS, 3); else res = 0; val = h[2].values[res]; if(vlc[3].table) res = get_vlc2(&gb, vlc[3].table, SMKTREE_BITS, 3); else res = 0; val |= h[3].values[res] << 8; pred[1] += (int16_t)val; *samples++ = pred[1]; } else { if(vlc[0].table) res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3); else res = 0; val = h[0].values[res]; if(vlc[1].table) res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3); else res = 0; val |= h[1].values[res] << 8; pred[0] += val; *samples++ = pred[0]; } } } else { for(i = stereo; i >= 0; i--) pred[i] = get_bits(&gb, 8); for(i = 0; i <= stereo; i++) *samples8++ = pred[i]; for(; i < unp_size; i++) { if(i & stereo){ if(vlc[1].table) res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3); else res = 0; pred[1] += (int8_t)h[1].values[res]; *samples8++ = pred[1]; } else { if(vlc[0].table) res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3); else res = 0; pred[0] += (int8_t)h[0].values[res]; *samples8++ = pred[0]; } } } for(i = 0; i < 4; i++) { if(vlc[i].table) free_vlc(&vlc[i]); av_free(h[i].bits); av_free(h[i].lengths); av_free(h[i].values); } *data_size = unp_size; return buf_size; } libavcodec/smacker.c:589: error: Null Dereference pointer `&gb->buffer` last assigned on line 587 could be null and is dereferenced by call to `get_bits1()` at line 589, column 9. libavcodec/smacker.c:570:1: start of procedure smka_decode_frame() 568. * Decode Smacker audio data 569. */ 570. static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) ^ 571. { 572. const uint8_t *buf = avpkt->data; libavcodec/smacker.c:572:5: 570. static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) 571. { 572. const uint8_t *buf = avpkt->data; ^ 573. int buf_size = avpkt->size; 574. GetBitContext gb; libavcodec/smacker.c:573:5: 571. { 572. const uint8_t *buf = avpkt->data; 573. int buf_size = avpkt->size; ^ 574. GetBitContext gb; 575. HuffContext h[4]; libavcodec/smacker.c:577:5: 575. HuffContext h[4]; 576. VLC vlc[4]; 577. int16_t *samples = data; ^ 578. int8_t *samples8 = data; 579. int val; libavcodec/smacker.c:578:5: 576. VLC vlc[4]; 577. int16_t *samples = data; 578. int8_t *samples8 = data; ^ 579. int val; 580. int i, res; libavcodec/smacker.c:583:5: 581. int unp_size; 582. int bits, stereo; 583. int pred[2] = {0, 0}; ^ 584. 585. unp_size = AV_RL32(buf); libavcodec/smacker.c:585:5: 583. int pred[2] = {0, 0}; 584. 585. unp_size = AV_RL32(buf); ^ 586. 587. init_get_bits(&gb, buf + 4, (buf_size - 4) * 8); libavcodec/smacker.c:587:5: 585. unp_size = AV_RL32(buf); 586. 587. init_get_bits(&gb, buf + 4, (buf_size - 4) * 8); ^ 588. 589. if(!get_bits1(&gb)){ libavcodec/get_bits.h:383:1: start of procedure init_get_bits() 381. * responsible for checking for the buffer end yourself (take advantage of the padding)! 382. */ 383. static inline void init_get_bits(GetBitContext *s, ^ 384. const uint8_t *buffer, int bit_size) 385. { libavcodec/get_bits.h:386:5: 384. const uint8_t *buffer, int bit_size) 385. { 386. int buffer_size = (bit_size+7)>>3; ^ 387. if (buffer_size < 0 || bit_size < 0) { 388. buffer_size = bit_size = 0; libavcodec/get_bits.h:387:9: Taking true branch 385. { 386. int buffer_size = (bit_size+7)>>3; 387. if (buffer_size < 0 || bit_size < 0) { ^ 388. buffer_size = bit_size = 0; 389. buffer = NULL; libavcodec/get_bits.h:388:9: 386. int buffer_size = (bit_size+7)>>3; 387. if (buffer_size < 0 || bit_size < 0) { 388. buffer_size = bit_size = 0; ^ 389. buffer = NULL; 390. } libavcodec/get_bits.h:389:9: 387. if (buffer_size < 0 || bit_size < 0) { 388. buffer_size = bit_size = 0; 389. buffer = NULL; ^ 390. } 391. libavcodec/get_bits.h:392:5: 390. } 391. 392. s->buffer = buffer; ^ 393. s->size_in_bits = bit_size; 394. s->buffer_end = buffer + buffer_size; libavcodec/get_bits.h:393:5: 391. 392. s->buffer = buffer; 393. s->size_in_bits = bit_size; ^ 394. s->buffer_end = buffer + buffer_size; 395. #ifdef ALT_BITSTREAM_READER libavcodec/get_bits.h:394:5: 392. s->buffer = buffer; 393. s->size_in_bits = bit_size; 394. s->buffer_end = buffer + buffer_size; ^ 395. #ifdef ALT_BITSTREAM_READER 396. s->index = 0; libavcodec/get_bits.h:396:5: 394. s->buffer_end = buffer + buffer_size; 395. #ifdef ALT_BITSTREAM_READER 396. s->index = 0; ^ 397. #elif defined A32_BITSTREAM_READER 398. s->buffer_ptr = (uint32_t*)((intptr_t)buffer & ~3); libavcodec/get_bits.h:402:1: return from a call to init_get_bits 400. skip_bits_long(s, 0); 401. #endif 402. } ^ 403. 404. static inline void align_get_bits(GetBitContext *s) libavcodec/smacker.c:589:9: 587. init_get_bits(&gb, buf + 4, (buf_size - 4) * 8); 588. 589. if(!get_bits1(&gb)){ ^ 590. av_log(avctx, AV_LOG_INFO, "Sound: no data\n"); 591. *data_size = 0; libavcodec/get_bits.h:303:1: start of procedure get_bits1() 301. } 302. 303. static inline unsigned int get_bits1(GetBitContext *s){ ^ 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; libavcodec/get_bits.h:305:5: 303. static inline unsigned int get_bits1(GetBitContext *s){ 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; ^ 306. uint8_t result = s->buffer[index>>3]; 307. #ifdef ALT_BITSTREAM_READER_LE libavcodec/get_bits.h:306:5: 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; 306. uint8_t result = s->buffer[index>>3]; ^ 307. #ifdef ALT_BITSTREAM_READER_LE 308. result >>= index & 7;
https://github.com/libav/libav/blob/d7d2f0e63c8187d531168256a0ce2aac21d5fce6/libavcodec/smacker.c/#L589