diff options
author | daurnimator <quae@daurnimator.com> | 2016-01-03 11:35:43 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2016-01-03 12:34:43 +1100 |
commit | 7a31bf07493d365f5b44581dc4aaf3c9d48179f0 (patch) | |
tree | ae9a39e95089552fd8673cdd80fcbfd110b33c64 | |
parent | b2b301db7ad41238fdd1b6236eb917c11bf0bbbc (diff) | |
download | luaossl-7a31bf07493d365f5b44581dc4aaf3c9d48179f0.tar.gz luaossl-7a31bf07493d365f5b44581dc4aaf3c9d48179f0.tar.bz2 luaossl-7a31bf07493d365f5b44581dc4aaf3c9d48179f0.zip |
bignum: bugfix: unm shouldn't modify it's operands
-rw-r--r-- | src/openssl.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/openssl.c b/src/openssl.c index e146098..a73917a 100644 --- a/src/openssl.c +++ b/src/openssl.c | |||
@@ -1924,8 +1924,9 @@ static int bn__shr(lua_State *L) { | |||
1924 | 1924 | ||
1925 | static int bn__unm(lua_State *L) { | 1925 | static int bn__unm(lua_State *L) { |
1926 | BIGNUM *a = checksimple(L, 1, BIGNUM_CLASS); | 1926 | BIGNUM *a = checksimple(L, 1, BIGNUM_CLASS); |
1927 | BIGNUM *r = bn_dup(L, a); | ||
1927 | 1928 | ||
1928 | BN_set_negative(a, !BN_is_negative(a)); | 1929 | BN_set_negative(r, !BN_is_negative(a)); |
1929 | 1930 | ||
1930 | return 1; | 1931 | return 1; |
1931 | } /* bn__unm() */ | 1932 | } /* bn__unm() */ |