test/ectest.c:1189: error: NULL_DEREFERENCE
  pointer `sect163r2_group` last assigned on line 1188 could be null and is dereferenced by call to `EC_GROUP_get0_field()` at line 1189, column 33.
Showing all 43 steps of the trace


test/ectest.c:1163:1: start of procedure group_field_test()
1161.   }
1162.   
1163. > static int group_field_test(void)
1164.   {
1165.       int r = 1;

test/ectest.c:1165:5: 
1163.   static int group_field_test(void)
1164.   {
1165. >     int r = 1;
1166.       BIGNUM *secp521r1_field = NULL;
1167.       BIGNUM *sect163r2_field = NULL;

test/ectest.c:1166:5: 
1164.   {
1165.       int r = 1;
1166. >     BIGNUM *secp521r1_field = NULL;
1167.       BIGNUM *sect163r2_field = NULL;
1168.       EC_GROUP *secp521r1_group = NULL;

test/ectest.c:1167:5: 
1165.       int r = 1;
1166.       BIGNUM *secp521r1_field = NULL;
1167. >     BIGNUM *sect163r2_field = NULL;
1168.       EC_GROUP *secp521r1_group = NULL;
1169.       EC_GROUP *sect163r2_group = NULL;

test/ectest.c:1168:5: 
1166.       BIGNUM *secp521r1_field = NULL;
1167.       BIGNUM *sect163r2_field = NULL;
1168. >     EC_GROUP *secp521r1_group = NULL;
1169.       EC_GROUP *sect163r2_group = NULL;
1170.   

test/ectest.c:1169:5: 
1167.       BIGNUM *sect163r2_field = NULL;
1168.       EC_GROUP *secp521r1_group = NULL;
1169. >     EC_GROUP *sect163r2_group = NULL;
1170.   
1171.       BN_hex2bn(&secp521r1_field,

test/ectest.c:1171:5: Skipping BN_hex2bn(): empty list of specs
1169.       EC_GROUP *sect163r2_group = NULL;
1170.   
1171.       BN_hex2bn(&secp521r1_field,
            ^
1172.                   "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
1173.                   "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"

test/ectest.c:1179:5: Skipping BN_hex2bn(): empty list of specs
1177.   
1178.   
1179.       BN_hex2bn(&sect163r2_field,
            ^
1180.                   "08000000000000000000000000000000"
1181.                   "00000000C9");

test/ectest.c:1183:5: 
1181.                   "00000000C9");
1182.   
1183. >     secp521r1_group = EC_GROUP_new_by_curve_name(NID_secp521r1);
1184.       if (BN_cmp(secp521r1_field, EC_GROUP_get0_field(secp521r1_group)))
1185.         r = 0;

crypto/ec/ec_curve.c:3121:1: start of procedure EC_GROUP_new_by_curve_name()
  3119.   }
  3120.   
  3121. > EC_GROUP *EC_GROUP_new_by_curve_name(int nid)
  3122.   {
  3123.       size_t i;

crypto/ec/ec_curve.c:3124:5: 
  3122.   {
  3123.       size_t i;
  3124. >     EC_GROUP *ret = NULL;
  3125.   
  3126.       if (nid <= 0)

crypto/ec/ec_curve.c:3126:9: Taking false branch
  3124.       EC_GROUP *ret = NULL;
  3125.   
  3126.       if (nid <= 0)
                  ^
  3127.           return NULL;
  3128.   

crypto/ec/ec_curve.c:3129:10: 
  3127.           return NULL;
  3128.   
  3129. >     for (i = 0; i < curve_list_length; i++)
  3130.           if (curve_list[i].nid == nid) {
  3131.               ret = ec_group_new_from_data(curve_list[i]);

crypto/ec/ec_curve.c:3129:17: Loop condition is true. Entering loop body
  3127.           return NULL;
  3128.   
  3129.       for (i = 0; i < curve_list_length; i++)
                          ^
  3130.           if (curve_list[i].nid == nid) {
  3131.               ret = ec_group_new_from_data(curve_list[i]);

crypto/ec/ec_curve.c:3130:13: Taking true branch
  3128.   
  3129.       for (i = 0; i < curve_list_length; i++)
  3130.           if (curve_list[i].nid == nid) {
                      ^
  3131.               ret = ec_group_new_from_data(curve_list[i]);
  3132.               break;

crypto/ec/ec_curve.c:3131:13: Skipping ec_group_new_from_data(): empty list of specs
  3129.       for (i = 0; i < curve_list_length; i++)
  3130.           if (curve_list[i].nid == nid) {
  3131.               ret = ec_group_new_from_data(curve_list[i]);
                      ^
  3132.               break;
  3133.           }

crypto/ec/ec_curve.c:3135:9: Taking false branch
  3133.           }
  3134.   
  3135.       if (ret == NULL) {
                  ^
  3136.           ECerr(EC_F_EC_GROUP_NEW_BY_CURVE_NAME, EC_R_UNKNOWN_GROUP);
  3137.           return NULL;

crypto/ec/ec_curve.c:3140:5: 
  3138.       }
  3139.   
  3140. >     return ret;
  3141.   }
  3142.   

crypto/ec/ec_curve.c:3141:1: return from a call to EC_GROUP_new_by_curve_name
  3139.   
  3140.       return ret;
  3141. > }
  3142.   
  3143.   size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems)

test/ectest.c:1184:9: 
1182.   
1183.       secp521r1_group = EC_GROUP_new_by_curve_name(NID_secp521r1);
1184. >     if (BN_cmp(secp521r1_field, EC_GROUP_get0_field(secp521r1_group)))
1185.         r = 0;
1186.   

crypto/ec/ec_lib.c:369:1: start of procedure EC_GROUP_get0_field()
  367.   }
  368.   
  369. > const BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group)
  370.   {
  371.       return group->field;

crypto/ec/ec_lib.c:371:5: 
  369.   const BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group)
  370.   {
  371. >     return group->field;
  372.   }
  373.   

crypto/ec/ec_lib.c:372:1: return from a call to EC_GROUP_get0_field
  370.   {
  371.       return group->field;
  372. > }
  373.   
  374.   void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag)

test/ectest.c:1184:9: Taking true branch
1182.   
1183.       secp521r1_group = EC_GROUP_new_by_curve_name(NID_secp521r1);
1184.       if (BN_cmp(secp521r1_field, EC_GROUP_get0_field(secp521r1_group)))
                ^
1185.         r = 0;
1186.   

test/ectest.c:1185:7: 
1183.       secp521r1_group = EC_GROUP_new_by_curve_name(NID_secp521r1);
1184.       if (BN_cmp(secp521r1_field, EC_GROUP_get0_field(secp521r1_group)))
1185. >       r = 0;
1186.   
1187.       # ifndef OPENSSL_NO_EC2M

test/ectest.c:1188:5: 
1186.   
1187.       # ifndef OPENSSL_NO_EC2M
1188. >     sect163r2_group = EC_GROUP_new_by_curve_name(NID_sect163r2);
1189.       if (BN_cmp(sect163r2_field, EC_GROUP_get0_field(sect163r2_group)))
1190.         r = 0;

crypto/ec/ec_curve.c:3121:1: start of procedure EC_GROUP_new_by_curve_name()
  3119.   }
  3120.   
  3121. > EC_GROUP *EC_GROUP_new_by_curve_name(int nid)
  3122.   {
  3123.       size_t i;

crypto/ec/ec_curve.c:3124:5: 
  3122.   {
  3123.       size_t i;
  3124. >     EC_GROUP *ret = NULL;
  3125.   
  3126.       if (nid <= 0)

crypto/ec/ec_curve.c:3126:9: Taking false branch
  3124.       EC_GROUP *ret = NULL;
  3125.   
  3126.       if (nid <= 0)
                  ^
  3127.           return NULL;
  3128.   

crypto/ec/ec_curve.c:3129:10: 
  3127.           return NULL;
  3128.   
  3129. >     for (i = 0; i < curve_list_length; i++)
  3130.           if (curve_list[i].nid == nid) {
  3131.               ret = ec_group_new_from_data(curve_list[i]);

crypto/ec/ec_curve.c:3129:17: Loop condition is true. Entering loop body
  3127.           return NULL;
  3128.   
  3129.       for (i = 0; i < curve_list_length; i++)
                          ^
  3130.           if (curve_list[i].nid == nid) {
  3131.               ret = ec_group_new_from_data(curve_list[i]);

crypto/ec/ec_curve.c:3130:13: Taking true branch
  3128.   
  3129.       for (i = 0; i < curve_list_length; i++)
  3130.           if (curve_list[i].nid == nid) {
                      ^
  3131.               ret = ec_group_new_from_data(curve_list[i]);
  3132.               break;

crypto/ec/ec_curve.c:3131:13: Skipping ec_group_new_from_data(): empty list of specs
  3129.       for (i = 0; i < curve_list_length; i++)
  3130.           if (curve_list[i].nid == nid) {
  3131.               ret = ec_group_new_from_data(curve_list[i]);
                      ^
  3132.               break;
  3133.           }

crypto/ec/ec_curve.c:3135:9: Taking true branch
  3133.           }
  3134.   
  3135.       if (ret == NULL) {
                  ^
  3136.           ECerr(EC_F_EC_GROUP_NEW_BY_CURVE_NAME, EC_R_UNKNOWN_GROUP);
  3137.           return NULL;

crypto/ec/ec_curve.c:3136:9: 
  3134.   
  3135.       if (ret == NULL) {
  3136. >         ECerr(EC_F_EC_GROUP_NEW_BY_CURVE_NAME, EC_R_UNKNOWN_GROUP);
  3137.           return NULL;
  3138.       }

providers/fips/fipsprov.c:193:1: start of procedure ERR_put_error()
    191.   }
    192.   
    193. > void ERR_put_error(int lib, int func, int reason, const char *file, int line)
    194.   {
    195.       /*

providers/fips/fipsprov.c:201:5: Skipping __function_pointer__(): unresolved function pointer
    199.        * so we'll need to come up with something else for them.
    200.        */
    201.       c_put_error(lib, func, reason, file, line);
               ^
    202.   }
    203.   

providers/fips/fipsprov.c:202:1: return from a call to ERR_put_error
    200.        */
    201.       c_put_error(lib, func, reason, file, line);
    202. > }
    203.   
    204.   void ERR_add_error_data(int num, ...)

crypto/ec/ec_curve.c:3137:9: 
  3135.       if (ret == NULL) {
  3136.           ECerr(EC_F_EC_GROUP_NEW_BY_CURVE_NAME, EC_R_UNKNOWN_GROUP);
  3137. >         return NULL;
  3138.       }
  3139.   

crypto/ec/ec_curve.c:3141:1: return from a call to EC_GROUP_new_by_curve_name
  3139.   
  3140.       return ret;
  3141. > }
  3142.   
  3143.   size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems)

test/ectest.c:1189:9: 
1187.       # ifndef OPENSSL_NO_EC2M
1188.       sect163r2_group = EC_GROUP_new_by_curve_name(NID_sect163r2);
1189. >     if (BN_cmp(sect163r2_field, EC_GROUP_get0_field(sect163r2_group)))
1190.         r = 0;
1191.       # endif

crypto/ec/ec_lib.c:369:1: start of procedure EC_GROUP_get0_field()
  367.   }
  368.   
  369. > const BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group)
  370.   {
  371.       return group->field;

crypto/ec/ec_lib.c:371:5: 
  369.   const BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group)
  370.   {
  371. >     return group->field;
  372.   }
  373.   

static int group_field_test(void)
{
    int r = 1;
    BIGNUM *secp521r1_field = NULL;
    BIGNUM *sect163r2_field = NULL;
    EC_GROUP *secp521r1_group = NULL;
    EC_GROUP *sect163r2_group = NULL;
    BN_hex2bn(&secp521r1_field,
                "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
                "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
                "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
                "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
                "FFFF");
    BN_hex2bn(&sect163r2_field,
                "08000000000000000000000000000000"
                "00000000C9");
    secp521r1_group = EC_GROUP_new_by_curve_name(NID_secp521r1);
    if (BN_cmp(secp521r1_field, EC_GROUP_get0_field(secp521r1_group)))
      r = 0;
    # ifndef OPENSSL_NO_EC2M
    sect163r2_group = EC_GROUP_new_by_curve_name(NID_sect163r2);
    if (BN_cmp(sect163r2_field, EC_GROUP_get0_field(sect163r2_group)))
      r = 0;
    # endif
    EC_GROUP_free(secp521r1_group);
    EC_GROUP_free(sect163r2_group);
    BN_free(secp521r1_field);
    BN_free(sect163r2_field);
    return r;
}
['static int group_field_test(void)\n{\n    int r = 1;\n    BIGNUM *secp521r1_field = NULL;\n    BIGNUM *sect163r2_field = NULL;\n    EC_GROUP *secp521r1_group = NULL;\n    EC_GROUP *sect163r2_group = NULL;\n    BN_hex2bn(&secp521r1_field,\n                "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n                "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n                "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n                "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"\n                "FFFF");\n    BN_hex2bn(&sect163r2_field,\n                "08000000000000000000000000000000"\n                "00000000C9");\n    secp521r1_group = EC_GROUP_new_by_curve_name(NID_secp521r1);\n    if (BN_cmp(secp521r1_field, EC_GROUP_get0_field(secp521r1_group)))\n      r = 0;\n    # ifndef OPENSSL_NO_EC2M\n    sect163r2_group = EC_GROUP_new_by_curve_name(NID_sect163r2);\n    if (BN_cmp(sect163r2_field, EC_GROUP_get0_field(sect163r2_group)))\n      r = 0;\n    # endif\n    EC_GROUP_free(secp521r1_group);\n    EC_GROUP_free(sect163r2_group);\n    BN_free(secp521r1_field);\n    BN_free(sect163r2_field);\n    return r;\n}', 'EC_GROUP *EC_GROUP_new_by_curve_name(int nid)\n{\n    size_t i;\n    EC_GROUP *ret = NULL;\n    if (nid <= 0)\n        return NULL;\n    for (i = 0; i < curve_list_length; i++)\n        if (curve_list[i].nid == nid) {\n            ret = ec_group_new_from_data(curve_list[i]);\n            break;\n        }\n    if (ret == NULL) {\n        ECerr(EC_F_EC_GROUP_NEW_BY_CURVE_NAME, EC_R_UNKNOWN_GROUP);\n        return NULL;\n    }\n    return ret;\n}', 'const BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group)\n{\n    return group->field;\n}', 'void ERR_put_error(int lib, int func, int reason, const char *file, int line)\n{\n    c_put_error(lib, func, reason, file, line);\n}']