Brad Bishop | 6f8dcde | 2018-10-16 10:47:12 +0800 | [diff] [blame] | 1 | From a2f43331a853b7cc449cae3361ee1fb54c7fad8d Mon Sep 17 00:00:00 2001 |
| 2 | From: Cyrill Gorcunov <gorcunov@gmail.com> |
| 3 | Date: Sat, 29 Sep 2018 14:30:14 +0300 |
| 4 | Subject: [PATCH] preproc: parse_size -- Check for string provided |
| 5 | |
| 6 | In case if the string is nil we will have sigsegv. |
| 7 | |
| 8 | https://bugzilla.nasm.us/show_bug.cgi?id=3392507 |
| 9 | |
| 10 | Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> |
| 11 | |
| 12 | CVE: CVE-2018-1000667 |
| 13 | Upstream-Status: Backport |
| 14 | https://repo.or.cz/nasm/nasm.git/commit/c713b5f994cf7b29164c3b6838b91f0499591434 |
| 15 | |
| 16 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> |
| 17 | --- |
| 18 | asm/preproc.c | 3 +-- |
| 19 | 1 file changed, 1 insertion(+), 2 deletions(-) |
| 20 | |
| 21 | diff --git a/asm/preproc.c b/asm/preproc.c |
| 22 | index 475926d..1d770a5 100644 |
| 23 | --- a/asm/preproc.c |
| 24 | +++ b/asm/preproc.c |
| 25 | @@ -2216,8 +2216,7 @@ static int parse_size(const char *str) { |
| 26 | { "byte", "dword", "oword", "qword", "tword", "word", "yword" }; |
| 27 | static const int sizes[] = |
| 28 | { 0, 1, 4, 16, 8, 10, 2, 32 }; |
| 29 | - |
| 30 | - return sizes[bsii(str, size_names, ARRAY_SIZE(size_names))+1]; |
| 31 | + return str ? sizes[bsii(str, size_names, ARRAY_SIZE(size_names))+1] : 0; |
| 32 | } |
| 33 | |
| 34 | /* |
| 35 | -- |
| 36 | 2.8.1 |
| 37 | |