summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2019-07-08 20:35:55 -0400
committerraveit65 <[email protected]>2019-07-13 16:15:45 +0200
commitd0a1884b2dda39ff43d4b2b18abe936a508ee5eb (patch)
tree3f20faf94ec8f54aafecafe5bd425bcea37223c0
parent27eebc7657b719dff236b2010f71cb0fc4e8cec3 (diff)
downloadmate-calc-d0a1884b2dda39ff43d4b2b18abe936a508ee5eb.tar.bz2
mate-calc-d0a1884b2dda39ff43d4b2b18abe936a508ee5eb.tar.xz
parserfunc: Return NULL on NOT operation overflow
-rw-r--r--src/mp-binary.c2
-rw-r--r--src/parserfunc.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/mp-binary.c b/src/mp-binary.c
index 8836776..d1de597 100644
--- a/src/mp-binary.c
+++ b/src/mp-binary.c
@@ -152,7 +152,7 @@ mp_not(const MPNumber *x, int wordlen, MPNumber *z)
if (!mp_is_positive_integer(x))
{
- /* Translators: Error displayed when boolean XOR attempted on non-integer values */
+ /* Translators: Error displayed when boolean NOT attempted on non-integer values */
mperr(_("Boolean NOT is only defined for positive integers"));
}
diff --git a/src/parserfunc.c b/src/parserfunc.c
index edd34f6..f35e6c5 100644
--- a/src/parserfunc.c
+++ b/src/parserfunc.c
@@ -866,7 +866,8 @@ pf_do_not(ParseNode* self)
{
set_error(self->state, PARSER_ERR_OVERFLOW, NULL);
free(ans);
- ans = NULL;
+ free(val);
+ return NULL;
}
mp_not(val, self->state->options->wordlen, ans);
free(val);