diff options
author | David Benjamin <davidben@google.com> | 2016-08-18 13:55:20 -0400 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2016-08-24 08:02:07 +0000 |
commit | 856bdfb2bd47e91950182d0c1427944e8e2ab771 (patch) | |
tree | 022a4b59c3af212a5f724cab891dfddbc8e05137 /annotations/generate_annotated_java_files.py | |
parent | 6da3d2252a573fdb31880aeb7a1714d8d1a42f84 (diff) |
Account for multiple errors in throwExceptionIfNecessary.
OpenSSL's error queue is somewhat difficult to use. It may push multiple
errors, not just a single one, as kind of a stack trace of sorts. It's
also unclear who is responsible for clearing the error queue after a
failed operation. (Changing this in BoringSSL is difficult due to API
constraints. See https://crbug.com/boringssl/38.)
There's three bugs here.
1. libcore's NativeBN code was not accounting for multiple errors in the
queue. ERR_get_error popped one error, but there needs to be an
ERR_clear_error call to clear everything.
2. libcore's NativeBN code checks whether the error queue is empty to
determine whether to fail. This isn't quite right as it makes it
sensitive to unrelated code failing to clear the error queue. (I also
suspect there are codepaths in BoringSSL where failures don't hit the
error queue just because it's so easy to forget.)
3. A recent change in BoringSSL caused BN_mod_inverse to push two errors
rather than one if the input did not have an inverse. This caused 1
and 2 to combine and manifest as a test failure in a later test.
Although two errors is perfectly legitimate per OpenSSL's API,
pushing ERR_R_INTERNAL_ERROR behind BN_R_NO_INVERSE doesn't make much
sense, so https://boringssl-review.googlesource.com/c/10483/ brings it
back to just the one error.
This CL fixes the first of three issues and should be sufficient to fix
the immediate test failure. The second will be fixed as a follow-up.
Bug: 30917411
Test: run cts -c org.apache.harmony.tests.java.math.BigIntegerTest
Change-Id: Ie3b3c2097cc85473a250e40efdd61729d04b9ba8
Diffstat (limited to 'annotations/generate_annotated_java_files.py')
0 files changed, 0 insertions, 0 deletions