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 40 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: Skipping ERR_put_error(): empty list of specs
  3134.   
  3135.       if (ret == NULL) {
  3136.           ECerr(EC_F_EC_GROUP_NEW_BY_CURVE_NAME, EC_R_UNKNOWN_GROUP);
                  ^
  3137.           return NULL;
  3138.       }

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.   
