Fabien 7506e064d7 Prevent arithmetic on NULL pointer if the scratch space is too small
If the scratch space is too small when calling
`secp256k1_ecmult_strauss_batch()`, the `state.pre_a` allocation will
fail and the pointer will be `NULL`. This causes `state.pre_a_lam` to be
computed from the `NULL` pointer.

It is also possible that the first allocation to fail is for `state.ps`,
which will cause the failure to occur when in
`secp256k1_ecmult_strauss_wnaf()`.

The issue has been detected by UBSAN using Clang 10:
```
CC=clang \
CFLAGS="-fsanitize=undefined -fno-omit-frame-pointer" \
LDFLAGS="-fsanitize=undefined -fno-omit-frame-pointer" \
../configure

UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 make check
```
2020-10-27 08:41:14 +01:00
..
2020-10-11 10:39:20 -07:00
2020-10-13 11:31:13 -07:00
2020-10-13 11:31:13 -07:00
2019-09-05 09:19:41 +02:00
2020-10-13 11:31:13 -07:00
2018-07-06 08:40:35 -04:00
2020-10-13 11:31:13 -07:00
2020-10-13 11:31:13 -07:00
2020-09-06 19:00:03 +00:00
2017-09-27 15:03:20 -07:00
2020-10-13 11:31:13 -07:00
2020-10-11 10:39:20 -07:00
2020-10-13 11:31:13 -07:00
2020-10-11 10:39:20 -07:00
2020-09-18 13:39:17 +02:00