Branch: Tag:

2014-12-04

2014-12-04 19:25:58 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Runtime: Improved robustness of parent_storage().

Under some circumstances parent_storage() could return
a storage pointer to a class that had inherited the
parent program. Fix this by making sure that we get the
storage for the program that we expect to find as parent.

561:    INIT    {    const struct ecc_curve *curve = -  (((const struct Nettle_ECC_Curve_struct *)parent_storage(1))->curve); +  (((const struct Nettle_ECC_Curve_struct *)parent_storage(1, Nettle_ECC_Curve_program))->curve);    if (!curve) Pike_error("No curve selected.\n");    ecc_point_init(&THIS->pub, curve);    ecc_scalar_init(&THIS->key, curve);
574:    EXIT    {    const struct ecc_curve *curve = -  (((const struct Nettle_ECC_Curve_struct *)parent_storage(1))->curve); +  (((const struct Nettle_ECC_Curve_struct *)parent_storage(1, Nettle_ECC_Curve_program))->curve);    if (!curve) return;    ecc_point_clear(&THIS->pub);    ecc_scalar_clear(&THIS->key);