test/evp_test.c:1556: error: NULL_DEREFERENCE
  pointer `edata` last assigned on line 1549 could be null and is dereferenced at line 1556, column 9.
Showing all 20 steps of the trace


test/evp_test.c:1547:1: start of procedure encode_test_init()
1545.   };
1546.   
1547. > static int encode_test_init(struct evp_test *t, const char *encoding)
1548.   {
1549.       struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));

test/evp_test.c:1549:5: 
1547.   static int encode_test_init(struct evp_test *t, const char *encoding)
1548.   {
1549. >     struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));
1550.   
1551.       if (strcmp(encoding, "canonical") == 0) {

crypto/mem.c:315:1: start of procedure CRYPTO_zalloc()
  313.   }
  314.   
  315. > void *CRYPTO_zalloc(int num, const char *file, int line)
  316.   {
  317.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:317:5: 
  315.   void *CRYPTO_zalloc(int num, const char *file, int line)
  316.   {
  317. >     void *ret = CRYPTO_malloc(num, file, line);
  318.   
  319.       if (ret != NULL)

crypto/mem.c:279:1: start of procedure CRYPTO_malloc()
    277.   }
    278.   
    279. > void *CRYPTO_malloc(int num, const char *file, int line)
    280.   {
    281.       void *ret = NULL;

crypto/mem.c:281:5: 
    279.   void *CRYPTO_malloc(int num, const char *file, int line)
    280.   {
    281. >     void *ret = NULL;
    282.   
    283.       if (num <= 0)

crypto/mem.c:283:9: Taking false branch
    281.       void *ret = NULL;
    282.   
    283.       if (num <= 0)
                   ^
    284.           return NULL;
    285.   

crypto/mem.c:286:9: Taking false branch
    284.           return NULL;
    285.   
    286.       if (allow_customize)
                   ^
    287.           allow_customize = 0;
    288.       if (malloc_debug_func != NULL) {

crypto/mem.c:288:9: Taking false branch
    286.       if (allow_customize)
    287.           allow_customize = 0;
    288.       if (malloc_debug_func != NULL) {
                   ^
    289.           if (allow_customize_debug)
    290.               allow_customize_debug = 0;

crypto/mem.c:293:5: Skipping __function_pointer__(): unresolved function pointer
    291.           malloc_debug_func(NULL, num, file, line, 0);
    292.       }
    293.       ret = malloc_ex_func(num, file, line);
               ^
    294.   #ifdef LEVITTE_DEBUG_MEM
    295.       fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:297:9: Taking false branch
    295.       fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
    296.   #endif
    297.       if (malloc_debug_func != NULL)
                   ^
    298.           malloc_debug_func(ret, num, file, line, 1);
    299.   

crypto/mem.c:312:5: 
    310.   #endif
    311.   
    312. >     return ret;
    313.   }
    314.   

crypto/mem.c:313:1: return from a call to CRYPTO_malloc
    311.   
    312.       return ret;
    313. > }
    314.   
    315.   void *CRYPTO_zalloc(int num, const char *file, int line)

crypto/mem.c:319:9: Taking false branch
  317.       void *ret = CRYPTO_malloc(num, file, line);
  318.   
  319.       if (ret != NULL)
                 ^
  320.           memset(ret, 0, num);
  321.       return ret;

crypto/mem.c:321:5: 
  319.       if (ret != NULL)
  320.           memset(ret, 0, num);
  321. >     return ret;
  322.   }
  323.   

crypto/mem.c:322:1: return from a call to CRYPTO_zalloc
  320.           memset(ret, 0, num);
  321.       return ret;
  322. > }
  323.   
  324.   char *CRYPTO_strdup(const char *str, const char *file, int line)

test/evp_test.c:1551:9: Taking false branch
1549.       struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));
1550.   
1551.       if (strcmp(encoding, "canonical") == 0) {
                ^
1552.           edata->encoding = BASE64_CANONICAL_ENCODING;
1553.       } else if (strcmp(encoding, "valid") == 0) {

test/evp_test.c:1553:16: Taking false branch
1551.       if (strcmp(encoding, "canonical") == 0) {
1552.           edata->encoding = BASE64_CANONICAL_ENCODING;
1553.       } else if (strcmp(encoding, "valid") == 0) {
                       ^
1554.           edata->encoding = BASE64_VALID_ENCODING;
1555.       } else if (strcmp(encoding, "invalid") == 0) {

test/evp_test.c:1555:16: Taking true branch
1553.       } else if (strcmp(encoding, "valid") == 0) {
1554.           edata->encoding = BASE64_VALID_ENCODING;
1555.       } else if (strcmp(encoding, "invalid") == 0) {
                       ^
1556.           edata->encoding = BASE64_INVALID_ENCODING;
1557.           t->expected_err = BUF_strdup("DECODE_ERROR");

test/evp_test.c:1556:9: 
1554.           edata->encoding = BASE64_VALID_ENCODING;
1555.       } else if (strcmp(encoding, "invalid") == 0) {
1556. >         edata->encoding = BASE64_INVALID_ENCODING;
1557.           t->expected_err = BUF_strdup("DECODE_ERROR");
1558.           if (t->expected_err == NULL)

static int encode_test_init(struct evp_test *t, const char *encoding)
{
    struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));
    if (strcmp(encoding, "canonical") == 0) {
        edata->encoding = BASE64_CANONICAL_ENCODING;
    } else if (strcmp(encoding, "valid") == 0) {
        edata->encoding = BASE64_VALID_ENCODING;
    } else if (strcmp(encoding, "invalid") == 0) {
        edata->encoding = BASE64_INVALID_ENCODING;
        t->expected_err = BUF_strdup("DECODE_ERROR");
        if (t->expected_err == NULL)
            return 0;
    } else {
        fprintf(stderr, "Bad encoding: %s. Should be one of "
                "{canonical, valid, invalid}\n", encoding);
        return 0;
    }
    t->data = edata;
    return 1;
}
['static int encode_test_init(struct evp_test *t, const char *encoding)\n{\n    struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));\n    if (strcmp(encoding, "canonical") == 0) {\n        edata->encoding = BASE64_CANONICAL_ENCODING;\n    } else if (strcmp(encoding, "valid") == 0) {\n        edata->encoding = BASE64_VALID_ENCODING;\n    } else if (strcmp(encoding, "invalid") == 0) {\n        edata->encoding = BASE64_INVALID_ENCODING;\n        t->expected_err = BUF_strdup("DECODE_ERROR");\n        if (t->expected_err == NULL)\n            return 0;\n    } else {\n        fprintf(stderr, "Bad encoding: %s. Should be one of "\n                "{canonical, valid, invalid}\\n", encoding);\n        return 0;\n    }\n    t->data = edata;\n    return 1;\n}', 'void *CRYPTO_zalloc(int num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(int num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (num <= 0)\n        return NULL;\n    if (allow_customize)\n        allow_customize = 0;\n    if (malloc_debug_func != NULL) {\n        if (allow_customize_debug)\n            allow_customize_debug = 0;\n        malloc_debug_func(NULL, num, file, line, 0);\n    }\n    ret = malloc_ex_func(num, file, line);\n#ifdef LEVITTE_DEBUG_MEM\n    fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\\n", ret, num);\n#endif\n    if (malloc_debug_func != NULL)\n        malloc_debug_func(ret, num, file, line, 1);\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}']