Bug 1626549 (CVE-2018-16517)

Summary: CVE-2018-16517 nasm: NULL Pointer Dereference in asm/labels.c
Product: [Other] Security Response Reporter: Laura Pardo <lpardo>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED WONTFIX QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: java-sig-commits, mizdebsk, nickc
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-10 10:37:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1626550, 1626551    
Bug Blocks: 1626554    

Description Laura Pardo 2018-09-07 15:29:07 UTC
A flaw was found in Netwide Assembler (NASM). A NULL Pointer Dereference in asm/labels.c which allows the attacker to cause a denial of service via a crafted file.


References:
https://bugzilla.nasm.us/show_bug.cgi?id=3392513
https://fakhrizulkifli.github.io/CVE-2018-16517.html

Comment 1 Laura Pardo 2018-09-07 15:29:29 UTC
Created nasm tracking bugs for this issue:

Affects: fedora-all [bug 1626550]

Comment 4 Scott Gayou 2018-10-17 16:29:59 UTC
Doesn't reproduce on any RHEL version.

Looks like it boils down to this (presumably "correct" logic in our older release):

```c
                        if (!output_ins.label)
                            nasm_error(ERR_NONFATAL,
                                         "EQU not preceded by label");

                        else if (output_ins.label[0] != '.' ||
```

whereas mainline had:

```c
                if (!output_ins.label)
                    nasm_error(ERR_NONFATAL,
                               "EQU not preceded by label");

                if (output_ins.operands == 1 &&
                    (output_ins.oprs[0].type & IMMEDIATE) &&
                    output_ins.oprs[0].wrt == NO_SEG) {
```

Patch added back the else -- i.e. the if/then should bail if !output_ins.label.