Fix a memory leak and add a number of small tests. #135

pull gmaxwell wants to merge 1 commits into bitcoin-core:master from gmaxwell:more_tests changing 2 files +72 −7
  1. gmaxwell commented at 9:06 AM on December 4, 2014: contributor

    This fixes a simple copy and paste induced memory leak for the ecdsa init.

    The tests are mostly just improving coverage and aren't interesting.

  2. Fix a memory leak and add a number of small tests.
    This fixes a simple copy and paste induced memory leak for the ecdsa init.
    
    The tests are mostly just improving coverage and aren't interesting.
    ee3eb4be9e
  3. in src/tests.c:None in 369565555c outdated
    1163 | @@ -1119,6 +1164,15 @@ int main(int argc, char **argv) {
    1164 |      /* initialize */
    1165 |      secp256k1_start(SECP256K1_START_SIGN | SECP256K1_START_VERIFY);
    1166 |  
    1167 | +    /* initializing a second time shouldn't cause any arm or memory leaks. */
    


    sipa commented at 11:16 AM on December 4, 2014:

    s/arm/harm/

  4. in src/tests.c:None in 369565555c outdated
    1208 | @@ -1155,5 +1209,14 @@ int main(int argc, char **argv) {
    1209 |  
    1210 |      /* shutdown */
    1211 |      secp256k1_stop();
    1212 | +
    1213 | +    /* shutting down twice shouldn't caue any double frees. */
    


    sipa commented at 11:16 AM on December 4, 2014:

    s/caue/cause/

  5. in src/tests.c:None in 369565555c outdated
    1071 | +        CHECK(secp256k1_ecdsa_recover_compact(msg32, 32, sigc64, pubkeyb, &pubkeyblen, 1, 0) == 1);
    1072 | +        CHECK(secp256k1_ecdsa_verify(msg32, 32, sigcder, sizeof(sigcder), pubkeyb, pubkeyblen) == 1);
    1073 | +        sigcder[4] = 0;
    1074 | +        sigc64[31] = 0;
    1075 | +        CHECK(secp256k1_ecdsa_recover_compact(msg32, 32, sigc64, pubkeyb, &pubkeyblen, 1, 0) == 0);
    1076 | +        CHECK(secp256k1_ecdsa_verify(msg32, 32, sigcder, sizeof(sigcder), pubkeyb, pubkeyblen) == 0);
    


    sipa commented at 11:45 AM on December 4, 2014:

    The contents of pubkeyb isn't well-defined if recover_compact returns false.

  6. gmaxwell commented at 3:17 PM on December 4, 2014: contributor

    Updated.

  7. sipa commented at 5:52 PM on December 4, 2014: contributor

    ACK

  8. sipa merged this on Dec 4, 2014
  9. sipa closed this on Dec 4, 2014

  10. sipa referenced this in commit b0210a95da on Dec 4, 2014
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 11:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me