Brad Bishop | 004d499 | 2018-10-02 23:54:45 +0200 | [diff] [blame^] | 1 | From ceec0d818798aeaa75ed4907e6135b0247ed46b2 Mon Sep 17 00:00:00 2001 |
| 2 | From: Cyrill Gorcunov <gorcunov@gmail.com> |
| 3 | Date: Sun, 14 Oct 2018 01:26:19 +0300 |
| 4 | Subject: [PATCH] eval: Eliminate division by zero |
| 5 | |
| 6 | When doing division we should detect if the value we're |
| 7 | divided by is not zero. Instead of is_unknown() helper |
| 8 | we should use is_just_unknown(). |
| 9 | |
| 10 | https://bugzilla.nasm.us/show_bug.cgi?id=3392515 |
| 11 | https://bugzilla.nasm.us/show_bug.cgi?id=3392473 |
| 12 | |
| 13 | Reported-by: Jun <jxx13@psu.edu> |
| 14 | Reported-by: stuartly <situlingyun@gmail.com> |
| 15 | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> |
| 16 | |
| 17 | Upstream-Status: Backport [https://github.com/netwide-assembler/nasm/commit/ceec0d818798aeaa75ed4907e6135b0247ed46b2.patch] |
| 18 | CVE: CVE-2018-10016 |
| 19 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> |
| 20 | |
| 21 | --- |
| 22 | asm/eval.c | 2 +- |
| 23 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 24 | |
| 25 | diff --git a/asm/eval.c b/asm/eval.c |
| 26 | index 1a6680f..7e727a4 100644 |
| 27 | --- a/asm/eval.c |
| 28 | +++ b/asm/eval.c |
| 29 | @@ -580,7 +580,7 @@ static expr *expr5(int critical) |
| 30 | " scalar values"); |
| 31 | return NULL; |
| 32 | } |
| 33 | - if (j != '*' && !is_unknown(f) && reloc_value(f) == 0) { |
| 34 | + if (j != '*' && !is_just_unknown(f) && reloc_value(f) == 0) { |
| 35 | nasm_error(ERR_NONFATAL, "division by zero"); |
| 36 | return NULL; |
| 37 | } |
| 38 | -- |
| 39 | 2.10.2 |
| 40 | |