test/testutil/tests.c:436: error: NULL_DEREFERENCE
  pointer `aa` last assigned on line 435 could be null and is dereferenced by call to `BN_set_negative()` at line 436, column 5.
Showing all 32 steps of the trace


test/testutil/tests.c:427:1: start of procedure test_BN_abs_eq_word()
425.   }
426.   
427. > int test_BN_abs_eq_word(const char *file, int line, const char *bns,
428.                           const char *ws, const BIGNUM *a, BN_ULONG w)
429.   {

test/testutil/tests.c:432:9: Taking true branch
430.       BIGNUM *bw, *aa;
431.   
432.       if (a != NULL && BN_abs_is_word(a, w))
               ^
433.           return 1;
434.       bw = BN_new();

test/testutil/tests.c:432:22: 
430.       BIGNUM *bw, *aa;
431.   
432. >     if (a != NULL && BN_abs_is_word(a, w))
433.           return 1;
434.       bw = BN_new();

crypto/bn/bn_lib.c:861:1: start of procedure BN_abs_is_word()
  859.   }
  860.   
  861. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
  862.   {
  863.       return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));

crypto/bn/bn_lib.c:863:14: Condition is false
  861.   int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
  862.   {
  863.       return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
                      ^
  864.   }
  865.   

crypto/bn/bn_lib.c:863:51: Condition is false
  861.   int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
  862.   {
  863.       return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
                                                           ^
  864.   }
  865.   

crypto/bn/bn_lib.c:863:12: 
  861.   int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
  862.   {
  863. >     return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
  864.   }
  865.   

crypto/bn/bn_lib.c:863:5: 
  861.   int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
  862.   {
  863. >     return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
  864.   }
  865.   

crypto/bn/bn_lib.c:864:1: return from a call to BN_abs_is_word
  862.   {
  863.       return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
  864. > }
  865.   
  866.   int BN_is_zero(const BIGNUM *a)

test/testutil/tests.c:432:22: Taking false branch
430.       BIGNUM *bw, *aa;
431.   
432.       if (a != NULL && BN_abs_is_word(a, w))
                            ^
433.           return 1;
434.       bw = BN_new();

test/testutil/tests.c:434:5: Skipping BN_new(): empty list of specs
432.       if (a != NULL && BN_abs_is_word(a, w))
433.           return 1;
434.       bw = BN_new();
           ^
435.       aa = BN_dup(a);
436.       BN_set_negative(aa, 0);

test/testutil/tests.c:435:5: 
433.           return 1;
434.       bw = BN_new();
435. >     aa = BN_dup(a);
436.       BN_set_negative(aa, 0);
437.       BN_set_word(bw, w);

crypto/bn/bn_lib.c:262:1: start of procedure BN_dup()
  260.   }
  261.   
  262. > BIGNUM *BN_dup(const BIGNUM *a)
  263.   {
  264.       BIGNUM *t;

crypto/bn/bn_lib.c:266:9: Taking false branch
  264.       BIGNUM *t;
  265.   
  266.       if (a == NULL)
                 ^
  267.           return NULL;
  268.       bn_check_top(a);

crypto/bn/bn_lib.c:270:9: 
  268.       bn_check_top(a);
  269.   
  270. >     t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new();
  271.       if (t == NULL)
  272.           return NULL;

crypto/bn/bn_lib.c:932:1: start of procedure BN_get_flags()
    930.   }
    931.   
    932. > int BN_get_flags(const BIGNUM *b, int n)
    933.   {
    934.       return b->flags & n;

crypto/bn/bn_lib.c:934:5: 
    932.   int BN_get_flags(const BIGNUM *b, int n)
    933.   {
    934. >     return b->flags & n;
    935.   }
    936.   

crypto/bn/bn_lib.c:935:1: return from a call to BN_get_flags
    933.   {
    934.       return b->flags & n;
    935. > }
    936.   
    937.   /* Populate a BN_GENCB structure with an "old"-style callback */

crypto/bn/bn_lib.c:270:9: Condition is true
  268.       bn_check_top(a);
  269.   
  270.       t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new();
                 ^
  271.       if (t == NULL)
  272.           return NULL;

crypto/bn/bn_lib.c:199:2: start of procedure BN_secure_new()
    197.   }
    198.   
    199.    BIGNUM *BN_secure_new(void)
            ^
    200.    {
    201.        BIGNUM *ret = BN_new();

crypto/bn/bn_lib.c:201:6: Skipping BN_new(): empty list of specs
    199.    BIGNUM *BN_secure_new(void)
    200.    {
    201.        BIGNUM *ret = BN_new();
                ^
    202.        if (ret != NULL)
    203.            ret->flags |= BN_FLG_SECURE;

crypto/bn/bn_lib.c:202:10: Taking false branch
    200.    {
    201.        BIGNUM *ret = BN_new();
    202.        if (ret != NULL)
                    ^
    203.            ret->flags |= BN_FLG_SECURE;
    204.        return ret;

crypto/bn/bn_lib.c:204:6: 
    202.        if (ret != NULL)
    203.            ret->flags |= BN_FLG_SECURE;
    204. >      return ret;
    205.    }
    206.   

crypto/bn/bn_lib.c:205:2: return from a call to BN_secure_new
    203.            ret->flags |= BN_FLG_SECURE;
    204.        return ret;
    205.    }
            ^
    206.   
    207.   /* This is used by bn_expand2() */

crypto/bn/bn_lib.c:270:5: 
  268.       bn_check_top(a);
  269.   
  270. >     t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new();
  271.       if (t == NULL)
  272.           return NULL;

crypto/bn/bn_lib.c:271:9: Taking true branch
  269.   
  270.       t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new();
  271.       if (t == NULL)
                 ^
  272.           return NULL;
  273.       if (!BN_copy(t, a)) {

crypto/bn/bn_lib.c:272:9: 
  270.       t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new();
  271.       if (t == NULL)
  272. >         return NULL;
  273.       if (!BN_copy(t, a)) {
  274.           BN_free(t);

crypto/bn/bn_lib.c:279:1: return from a call to BN_dup
  277.       bn_check_top(t);
  278.       return t;
  279. > }
  280.   
  281.   BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)

test/testutil/tests.c:436:5: 
434.       bw = BN_new();
435.       aa = BN_dup(a);
436. >     BN_set_negative(aa, 0);
437.       BN_set_word(bw, w);
438.       test_fail_bignum_message(NULL, file, line, "BIGNUM", bns, ws, "abs==",

crypto/bn/bn_lib.c:705:1: start of procedure BN_set_negative()
  703.   }
  704.   
  705. > void BN_set_negative(BIGNUM *a, int b)
  706.   {
  707.       if (b && !BN_is_zero(a))

crypto/bn/bn_lib.c:707:9: Taking false branch
  705.   void BN_set_negative(BIGNUM *a, int b)
  706.   {
  707.       if (b && !BN_is_zero(a))
                 ^
  708.           a->neg = 1;
  709.       else

crypto/bn/bn_lib.c:710:9: 
  708.           a->neg = 1;
  709.       else
  710. >         a->neg = 0;
  711.   }
  712.   

int test_BN_abs_eq_word(const char *file, int line, const char *bns,
                        const char *ws, const BIGNUM *a, BN_ULONG w)
{
    BIGNUM *bw, *aa;
    if (a != NULL && BN_abs_is_word(a, w))
        return 1;
    bw = BN_new();
    aa = BN_dup(a);
    BN_set_negative(aa, 0);
    BN_set_word(bw, w);
    test_fail_bignum_message(NULL, file, line, "BIGNUM", bns, ws, "abs==",
                             aa, bw);
    BN_free(bw);
    BN_free(aa);
    return 0;
}
['int test_BN_abs_eq_word(const char *file, int line, const char *bns,\n                        const char *ws, const BIGNUM *a, BN_ULONG w)\n{\n    BIGNUM *bw, *aa;\n    if (a != NULL && BN_abs_is_word(a, w))\n        return 1;\n    bw = BN_new();\n    aa = BN_dup(a);\n    BN_set_negative(aa, 0);\n    BN_set_word(bw, w);\n    test_fail_bignum_message(NULL, file, line, "BIGNUM", bns, ws, "abs==",\n                             aa, bw);\n    BN_free(bw);\n    BN_free(aa);\n    return 0;\n}', 'int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)\n{\n    return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));\n}', 'BIGNUM *BN_dup(const BIGNUM *a)\n{\n    BIGNUM *t;\n    if (a == NULL)\n        return NULL;\n    bn_check_top(a);\n    t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new();\n    if (t == NULL)\n        return NULL;\n    if (!BN_copy(t, a)) {\n        BN_free(t);\n        return NULL;\n    }\n    bn_check_top(t);\n    return t;\n}', 'int BN_get_flags(const BIGNUM *b, int n)\n{\n    return b->flags & n;\n}', 'BIGNUM *BN_secure_new(void)\n {\n     BIGNUM *ret = BN_new();\n     if (ret != NULL)\n         ret->flags |= BN_FLG_SECURE;\n     return ret;\n }', 'void BN_set_negative(BIGNUM *a, int b)\n{\n    if (b && !BN_is_zero(a))\n        a->neg = 1;\n    else\n        a->neg = 0;\n}']