crypto/x509v3/v3_scts.c:138: error: NULL_DEREFERENCE
  pointer `gen` last assigned on line 129 could be null and is dereferenced by call to `ASN1_STRING_data()` at line 138, column 18.
Showing all 57 steps of the trace


crypto/x509v3/v3_scts.c:125:1: start of procedure timestamp_print()
123.   }
124.   
125. > static void timestamp_print(BIO *out, uint64_t timestamp)
126.   {
127.       ASN1_GENERALIZEDTIME *gen;

crypto/x509v3/v3_scts.c:129:5: 
127.       ASN1_GENERALIZEDTIME *gen;
128.       char genstr[20];
129. >     gen = ASN1_GENERALIZEDTIME_new();
130.       ASN1_GENERALIZEDTIME_adj(gen, (time_t)0,
131.                                (int)(timestamp / 86400000),

crypto/asn1/tasn_typ.c:86:1: start of procedure ASN1_GENERALIZEDTIME_new()
  84.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALSTRING)
  85.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTCTIME)
  86. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALIZEDTIME)
  87.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_VISIBLESTRING)
  88.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UNIVERSALSTRING)

crypto/asn1/asn1_lib.c:348:1: start of procedure ASN1_STRING_type_new()
    346.   }
    347.   
    348. > ASN1_STRING *ASN1_STRING_type_new(int type)
    349.   {
    350.       ASN1_STRING *ret;

crypto/asn1/asn1_lib.c:352:5: 
    350.       ASN1_STRING *ret;
    351.   
    352. >     ret = OPENSSL_zalloc(sizeof(*ret));
    353.       if (ret == NULL) {
    354.           ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);

crypto/mem.c:156:1: start of procedure CRYPTO_zalloc()
      154.   }
      155.   
      156. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
      157.   {
      158.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:158:5: 
      156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
      157.   {
      158. >     void *ret = CRYPTO_malloc(num, file, line);
      159.   
      160.       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 (num <= 0)

crypto/mem.c:123:9: Taking false branch
        121.       void *ret = NULL;
        122.   
        123.       if (num <= 0)
                       ^
        124.           return NULL;
        125.   

crypto/mem.c:126:5: 
        124.           return NULL;
        125.   
        126. >     allow_customize = 0;
        127.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
        128.       if (call_malloc_debug) {

crypto/mem.c:136:5: 
        134.       }
        135.   #else
        136. >     (void)file;
        137.       (void)line;
        138.       ret = malloc(num);

crypto/mem.c:137:5: 
        135.   #else
        136.       (void)file;
        137. >     (void)line;
        138.       ret = malloc(num);
        139.   #endif

crypto/mem.c:138:5: 
        136.       (void)file;
        137.       (void)line;
        138. >     ret = malloc(num);
        139.   #endif
        140.   

crypto/mem.c:153:5: 
        151.   #endif
        152.   
        153. >     return ret;
        154.   }
        155.   

crypto/mem.c:154:1: return from a call to CRYPTO_malloc
        152.   
        153.       return ret;
        154. > }
        155.   
        156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:160:9: Taking false branch
      158.       void *ret = CRYPTO_malloc(num, file, line);
      159.   
      160.       if (ret != NULL)
                     ^
      161.           memset(ret, 0, num);
      162.       return ret;

crypto/mem.c:162:5: 
      160.       if (ret != NULL)
      161.           memset(ret, 0, num);
      162. >     return ret;
      163.   }
      164.   

crypto/mem.c:163:1: return from a call to CRYPTO_zalloc
      161.           memset(ret, 0, num);
      162.       return ret;
      163. > }
      164.   
      165.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/asn1/asn1_lib.c:353:9: Taking true branch
    351.   
    352.       ret = OPENSSL_zalloc(sizeof(*ret));
    353.       if (ret == NULL) {
                   ^
    354.           ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
    355.           return (NULL);

crypto/asn1/asn1_lib.c:354:9: Skipping ERR_put_error(): empty list of specs
    352.       ret = OPENSSL_zalloc(sizeof(*ret));
    353.       if (ret == NULL) {
    354.           ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
                   ^
    355.           return (NULL);
    356.       }

crypto/asn1/asn1_lib.c:355:9: 
    353.       if (ret == NULL) {
    354.           ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
    355. >         return (NULL);
    356.       }
    357.       ret->type = type;

crypto/asn1/asn1_lib.c:359:1: return from a call to ASN1_STRING_type_new
    357.       ret->type = type;
    358.       return (ret);
    359. > }
    360.   
    361.   void ASN1_STRING_free(ASN1_STRING *a)

crypto/asn1/tasn_typ.c:86:1: return from a call to ASN1_GENERALIZEDTIME_new
  84.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALSTRING)
  85.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTCTIME)
  86. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALIZEDTIME)
  87.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_VISIBLESTRING)
  88.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UNIVERSALSTRING)

crypto/x509v3/v3_scts.c:130:5: 
128.       char genstr[20];
129.       gen = ASN1_GENERALIZEDTIME_new();
130. >     ASN1_GENERALIZEDTIME_adj(gen, (time_t)0,
131.                                (int)(timestamp / 86400000),
132.                                (timestamp % 86400000) / 1000);

crypto/asn1/a_gentm.c:215:1: start of procedure ASN1_GENERALIZEDTIME_adj()
  213.   }
  214.   
  215. > ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
  216.                                                  time_t t, int offset_day,
  217.                                                  long offset_sec)

crypto/asn1/a_gentm.c:222:5: 
  220.       struct tm *ts;
  221.       struct tm data;
  222. >     size_t len = 20;
  223.   
  224.       if (s == NULL)

crypto/asn1/a_gentm.c:224:9: Taking true branch
  222.       size_t len = 20;
  223.   
  224.       if (s == NULL)
                 ^
  225.           s = ASN1_GENERALIZEDTIME_new();
  226.       if (s == NULL)

crypto/asn1/a_gentm.c:225:9: 
  223.   
  224.       if (s == NULL)
  225. >         s = ASN1_GENERALIZEDTIME_new();
  226.       if (s == NULL)
  227.           return (NULL);

crypto/asn1/tasn_typ.c:86:1: start of procedure ASN1_GENERALIZEDTIME_new()
    84.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALSTRING)
    85.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTCTIME)
    86. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALIZEDTIME)
    87.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_VISIBLESTRING)
    88.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UNIVERSALSTRING)

crypto/asn1/asn1_lib.c:348:1: start of procedure ASN1_STRING_type_new()
      346.   }
      347.   
      348. > ASN1_STRING *ASN1_STRING_type_new(int type)
      349.   {
      350.       ASN1_STRING *ret;

crypto/asn1/asn1_lib.c:352:5: 
      350.       ASN1_STRING *ret;
      351.   
      352. >     ret = OPENSSL_zalloc(sizeof(*ret));
      353.       if (ret == NULL) {
      354.           ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);

crypto/mem.c:156:1: start of procedure CRYPTO_zalloc()
        154.   }
        155.   
        156. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
        157.   {
        158.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:158:5: 
        156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
        157.   {
        158. >     void *ret = CRYPTO_malloc(num, file, line);
        159.   
        160.       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 (num <= 0)

crypto/mem.c:123:9: Taking false branch
          121.       void *ret = NULL;
          122.   
          123.       if (num <= 0)
                         ^
          124.           return NULL;
          125.   

crypto/mem.c:126:5: 
          124.           return NULL;
          125.   
          126. >     allow_customize = 0;
          127.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
          128.       if (call_malloc_debug) {

crypto/mem.c:136:5: 
          134.       }
          135.   #else
          136. >     (void)file;
          137.       (void)line;
          138.       ret = malloc(num);

crypto/mem.c:137:5: 
          135.   #else
          136.       (void)file;
          137. >     (void)line;
          138.       ret = malloc(num);
          139.   #endif

crypto/mem.c:138:5: 
          136.       (void)file;
          137.       (void)line;
          138. >     ret = malloc(num);
          139.   #endif
          140.   

crypto/mem.c:153:5: 
          151.   #endif
          152.   
          153. >     return ret;
          154.   }
          155.   

crypto/mem.c:154:1: return from a call to CRYPTO_malloc
          152.   
          153.       return ret;
          154. > }
          155.   
          156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:160:9: Taking false branch
        158.       void *ret = CRYPTO_malloc(num, file, line);
        159.   
        160.       if (ret != NULL)
                       ^
        161.           memset(ret, 0, num);
        162.       return ret;

crypto/mem.c:162:5: 
        160.       if (ret != NULL)
        161.           memset(ret, 0, num);
        162. >     return ret;
        163.   }
        164.   

crypto/mem.c:163:1: return from a call to CRYPTO_zalloc
        161.           memset(ret, 0, num);
        162.       return ret;
        163. > }
        164.   
        165.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/asn1/asn1_lib.c:353:9: Taking true branch
      351.   
      352.       ret = OPENSSL_zalloc(sizeof(*ret));
      353.       if (ret == NULL) {
                     ^
      354.           ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
      355.           return (NULL);

crypto/asn1/asn1_lib.c:354:9: Skipping ERR_put_error(): empty list of specs
      352.       ret = OPENSSL_zalloc(sizeof(*ret));
      353.       if (ret == NULL) {
      354.           ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
                     ^
      355.           return (NULL);
      356.       }

crypto/asn1/asn1_lib.c:355:9: 
      353.       if (ret == NULL) {
      354.           ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
      355. >         return (NULL);
      356.       }
      357.       ret->type = type;

crypto/asn1/asn1_lib.c:359:1: return from a call to ASN1_STRING_type_new
      357.       ret->type = type;
      358.       return (ret);
      359. > }
      360.   
      361.   void ASN1_STRING_free(ASN1_STRING *a)

crypto/asn1/tasn_typ.c:86:1: return from a call to ASN1_GENERALIZEDTIME_new
    84.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALSTRING)
    85.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTCTIME)
    86. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALIZEDTIME)
    87.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_VISIBLESTRING)
    88.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UNIVERSALSTRING)

crypto/asn1/a_gentm.c:226:9: Taking true branch
  224.       if (s == NULL)
  225.           s = ASN1_GENERALIZEDTIME_new();
  226.       if (s == NULL)
                 ^
  227.           return (NULL);
  228.   

crypto/asn1/a_gentm.c:227:9: 
  225.           s = ASN1_GENERALIZEDTIME_new();
  226.       if (s == NULL)
  227. >         return (NULL);
  228.   
  229.       ts = OPENSSL_gmtime(&t, &data);

crypto/asn1/a_gentm.c:258:1: return from a call to ASN1_GENERALIZEDTIME_adj
  256.   #endif
  257.       return (s);
  258. > }
  259.   
  260.   const char *_asn1_mon[12] = {

crypto/x509v3/v3_scts.c:137:5: 
135.        * characters long with a final Z. Update it with fractional seconds.
136.        */
137. >     BIO_snprintf(genstr, sizeof(genstr), "%.14s.%03dZ",
138.                    ASN1_STRING_data(gen), (unsigned int)(timestamp % 1000));
139.       ASN1_GENERALIZEDTIME_set_string(gen, genstr);

crypto/asn1/asn1_lib.c:410:1: start of procedure ASN1_STRING_data()
  408.   }
  409.   
  410. > unsigned char *ASN1_STRING_data(ASN1_STRING *x)
  411.   {
  412.       return x->data;

crypto/asn1/asn1_lib.c:412:5: 
  410.   unsigned char *ASN1_STRING_data(ASN1_STRING *x)
  411.   {
  412. >     return x->data;
  413.   }
