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


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

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

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

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

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

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

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

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

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

crypto/ec/ec_curve.c:3117:1: start of procedure EC_GROUP_new_by_curve_name()
  3115.   }
  3116.   
  3117. > EC_GROUP *EC_GROUP_new_by_curve_name(int nid)
  3118.   {
  3119.       size_t i;

crypto/ec/ec_curve.c:3120:5: 
  3118.   {
  3119.       size_t i;
  3120. >     EC_GROUP *ret = NULL;
  3121.   
  3122.       if (nid <= 0)

crypto/ec/ec_curve.c:3122:9: Taking false branch
  3120.       EC_GROUP *ret = NULL;
  3121.   
  3122.       if (nid <= 0)
                  ^
  3123.           return NULL;
  3124.   

crypto/ec/ec_curve.c:3125:10: 
  3123.           return NULL;
  3124.   
  3125. >     for (i = 0; i < curve_list_length; i++)
  3126.           if (curve_list[i].nid == nid) {
  3127.               ret = ec_group_new_from_data(curve_list[i]);

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

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

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

crypto/ec/ec_curve.c:3131:9: Taking false branch
  3129.           }
  3130.   
  3131.       if (ret == NULL) {
                  ^
  3132.           ECerr(EC_F_EC_GROUP_NEW_BY_CURVE_NAME, EC_R_UNKNOWN_GROUP);
  3133.           return NULL;

crypto/ec/ec_curve.c:3136:5: 
  3134.       }
  3135.   
  3136. >     return ret;
  3137.   }
  3138.   

crypto/ec/ec_curve.c:3137:1: return from a call to EC_GROUP_new_by_curve_name
  3135.   
  3136.       return ret;
  3137. > }
  3138.   
  3139.   size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems)

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

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

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

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

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

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

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

crypto/ec/ec_curve.c:3117:1: start of procedure EC_GROUP_new_by_curve_name()
  3115.   }
  3116.   
  3117. > EC_GROUP *EC_GROUP_new_by_curve_name(int nid)
  3118.   {
  3119.       size_t i;

crypto/ec/ec_curve.c:3120:5: 
  3118.   {
  3119.       size_t i;
  3120. >     EC_GROUP *ret = NULL;
  3121.   
  3122.       if (nid <= 0)

crypto/ec/ec_curve.c:3122:9: Taking false branch
  3120.       EC_GROUP *ret = NULL;
  3121.   
  3122.       if (nid <= 0)
                  ^
  3123.           return NULL;
  3124.   

crypto/ec/ec_curve.c:3125:10: 
  3123.           return NULL;
  3124.   
  3125. >     for (i = 0; i < curve_list_length; i++)
  3126.           if (curve_list[i].nid == nid) {
  3127.               ret = ec_group_new_from_data(curve_list[i]);

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

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

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

crypto/ec/ec_curve.c:3131:9: Taking true branch
  3129.           }
  3130.   
  3131.       if (ret == NULL) {
                  ^
  3132.           ECerr(EC_F_EC_GROUP_NEW_BY_CURVE_NAME, EC_R_UNKNOWN_GROUP);
  3133.           return NULL;

crypto/ec/ec_curve.c:3132:9: Skipping ERR_put_error(): empty list of specs
  3130.   
  3131.       if (ret == NULL) {
  3132.           ECerr(EC_F_EC_GROUP_NEW_BY_CURVE_NAME, EC_R_UNKNOWN_GROUP);
                  ^
  3133.           return NULL;
  3134.       }

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

crypto/ec/ec_curve.c:3137:1: return from a call to EC_GROUP_new_by_curve_name
  3135.   
  3136.       return ret;
  3137. > }
  3138.   
  3139.   size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems)

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

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

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

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}']