Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-02-19 02:19:19 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-02-19 02:19:19 +0300
commit1d15421af97980e4a149490fe31a325fed070853 (patch)
treef2b5df56634b42d5c6e5e4b6675f4b332c0d6f6e /source/blender/editors/util/numinput.c
parent60e53e0ce68a1823b3a20b007181f23b2c5c7453 (diff)
Fix T47477: Transform allows 'inf' input
Numeric input wasn't checking numbers were finite, could crash transforming with skin modifier.
Diffstat (limited to 'source/blender/editors/util/numinput.c')
-rw-r--r--source/blender/editors/util/numinput.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c
index 9bb4e050ae6..e07831358d6 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -477,6 +477,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
/* At this point, our value has changed, try to interpret it with python (if str is not empty!). */
if (n->str[0]) {
+ const float val_prev = n->val[idx];
#ifdef WITH_PYTHON
Scene *sce = CTX_data_scene(C);
double val;
@@ -514,6 +515,11 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
if (n->val_flag[idx] & NUM_INVERSE) {
n->val[idx] = 1.0f / n->val[idx];
}
+
+ if (UNLIKELY(!isfinite(n->val[idx]))) {
+ n->val[idx] = val_prev;
+ n->val_flag[idx] |= NUM_INVALID;
+ }
}
/* REDRAW SINCE NUMBERS HAVE CHANGED */