crypto/asn1/a_int.c:373: error: NULL_DEREFERENCE
  pointer `null` is dereferenced by call to `ASN1_STRING_set()` at line 373, column 9.
Showing all 60 steps of the trace


crypto/asn1/a_int.c:353:1: start of procedure c2i_ASN1_INTEGER()
351.   
352.   /* Convert ASN1 INTEGER content octets to ASN1_INTEGER structure */
353. > ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
354.                                  long len)
355.   {

crypto/asn1/a_int.c:356:5: 
354.                                  long len)
355.   {
356. >     ASN1_INTEGER *ret = NULL;
357.       size_t r;
358.       int neg;

crypto/asn1/a_int.c:360:5: Skipping c2i_ibuf(): empty list of specs
358.       int neg;
359.   
360.       r = c2i_ibuf(NULL, NULL, *pp, len);
           ^
361.   
362.       if (r == 0)

crypto/asn1/a_int.c:362:9: Taking false branch
360.       r = c2i_ibuf(NULL, NULL, *pp, len);
361.   
362.       if (r == 0)
               ^
363.           return NULL;
364.   

crypto/asn1/a_int.c:365:10: Taking false branch
363.           return NULL;
364.   
365.       if ((a == NULL) || ((*a) == NULL)) {
                ^
366.           ret = ASN1_INTEGER_new();
367.           if (ret == NULL)

crypto/asn1/a_int.c:365:25: Taking true branch
363.           return NULL;
364.   
365.       if ((a == NULL) || ((*a) == NULL)) {
                               ^
366.           ret = ASN1_INTEGER_new();
367.           if (ret == NULL)

crypto/asn1/a_int.c:366:9: 
364.   
365.       if ((a == NULL) || ((*a) == NULL)) {
366. >         ret = ASN1_INTEGER_new();
367.           if (ret == NULL)
368.               return NULL;

crypto/asn1/tasn_typ.c:78:1: start of procedure ASN1_INTEGER_new()
  76.   
  77.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  78. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  79.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
  80.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING)

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.   #ifdef 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:78:1: return from a call to ASN1_INTEGER_new
  76.   
  77.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  78. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  79.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
  80.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING)

crypto/asn1/a_int.c:367:13: Taking false branch
365.       if ((a == NULL) || ((*a) == NULL)) {
366.           ret = ASN1_INTEGER_new();
367.           if (ret == NULL)
                   ^
368.               return NULL;
369.           ret->type = V_ASN1_INTEGER;

crypto/asn1/a_int.c:369:9: 
367.           if (ret == NULL)
368.               return NULL;
369. >         ret->type = V_ASN1_INTEGER;
370.       } else
371.           ret = *a;

crypto/asn1/a_int.c:373:9: 
371.           ret = *a;
372.   
373. >     if (ASN1_STRING_set(ret, NULL, r) == 0)
374.           goto err;
375.   

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 false 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:319:33: 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 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 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.   #ifdef 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: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)

ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
                               long len)
{
    ASN1_INTEGER *ret = NULL;
    size_t r;
    int neg;
    r = c2i_ibuf(NULL, NULL, *pp, len);
    if (r == 0)
        return NULL;
    if ((a == NULL) || ((*a) == NULL)) {
        ret = ASN1_INTEGER_new();
        if (ret == NULL)
            return NULL;
        ret->type = V_ASN1_INTEGER;
    } else
        ret = *a;
    if (ASN1_STRING_set(ret, NULL, r) == 0)
        goto err;
    c2i_ibuf(ret->data, &neg, *pp, len);
    if (neg)
        ret->type |= V_ASN1_NEG;
    *pp += len;
    if (a != NULL)
        (*a) = ret;
    return ret;
 err:
    ASN1err(ASN1_F_C2I_ASN1_INTEGER, ERR_R_MALLOC_FAILURE);
    if ((a == NULL) || (*a != ret))
        ASN1_INTEGER_free(ret);
    return NULL;
}
['ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,\n                               long len)\n{\n    ASN1_INTEGER *ret = NULL;\n    size_t r;\n    int neg;\n    r = c2i_ibuf(NULL, NULL, *pp, len);\n    if (r == 0)\n        return NULL;\n    if ((a == NULL) || ((*a) == NULL)) {\n        ret = ASN1_INTEGER_new();\n        if (ret == NULL)\n            return NULL;\n        ret->type = V_ASN1_INTEGER;\n    } else\n        ret = *a;\n    if (ASN1_STRING_set(ret, NULL, r) == 0)\n        goto err;\n    c2i_ibuf(ret->data, &neg, *pp, len);\n    if (neg)\n        ret->type |= V_ASN1_NEG;\n    *pp += len;\n    if (a != NULL)\n        (*a) = ret;\n    return ret;\n err:\n    ASN1err(ASN1_F_C2I_ASN1_INTEGER, ERR_R_MALLOC_FAILURE);\n    if ((a == NULL) || (*a != ret))\n        ASN1_INTEGER_free(ret);\n    return NULL;\n}', 'IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)', 'ASN1_STRING *ASN1_STRING_type_new(int type)\n{\n    ASN1_STRING *ret;\n    ret = OPENSSL_zalloc(sizeof(*ret));\n    if (ret == NULL) {\n        ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);\n        return (NULL);\n    }\n    ret->type = type;\n    return (ret);\n}', 'void *CRYPTO_zalloc(size_t 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(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (num <= 0)\n        return NULL;\n    allow_customize = 0;\n#ifdef CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)file;\n    (void)line;\n    ret = malloc(num);\n#endif\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}', "int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)\n{\n    unsigned char *c;\n    const char *data = _data;\n    if (len < 0) {\n        if (data == NULL)\n            return (0);\n        else\n            len = strlen(data);\n    }\n    if ((str->length < len) || (str->data == NULL)) {\n        c = str->data;\n        str->data = OPENSSL_realloc(c, len + 1);\n        if (str->data == NULL) {\n            ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE);\n            str->data = c;\n            return (0);\n        }\n    }\n    str->length = len;\n    if (data != NULL) {\n        memcpy(str->data, data, len);\n        str->data[len] = '\\0';\n    }\n    return (1);\n}", 'void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)\n{\n    if (str == NULL)\n        return CRYPTO_malloc(num, file, line);\n    if (num == 0) {\n        CRYPTO_free(str);\n        return NULL;\n    }\n    allow_customize = 0;\n#ifdef CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        void *ret;\n        CRYPTO_mem_debug_realloc(str, NULL, num, 0, file, line);\n        ret = realloc(str, num);\n        CRYPTO_mem_debug_realloc(str, ret, num, 1, file, line);\n        return ret;\n    }\n#else\n    (void)file;\n    (void)line;\n#endif\n    return realloc(str, num);\n}']