[llvm-bugs] [Bug 39639] New: Improve Memory Allocation Backtraces when Reporting Errors.
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Nov 12 12:22:10 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=39639
Bug ID: 39639
Summary: Improve Memory Allocation Backtraces when Reporting
Errors.
Product: clang
Version: 7.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: dcoughlin at apple.com
Reporter: swestrup at gmail.com
CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org
Created attachment 21113
--> https://bugs.llvm.org/attachment.cgi?id=21113&action=edit
Clang Static Analysis Report on jpegdump.c
Recently when performing a scan-build on a large project, an uninitialized
pointer used as a parameter was reported on a function in a utility to dump the
structures of jpeg files. I'm attaching the report below.
The salient error is reported at line 659, but the routine that triggers the
bug is blameless, and there is no information there on the source of the bug.
If one looks at the place where the actual bug is, in the "load_images" routine
starting on line 1011, the trace information there is not only irrelevant, its
actaully misleading as to what the bug is.
The actual bug is that the variable nptr is being checked for null, (something
that should never happen in practice) and if it ever is, the allocation routine
aborts early without having allocated all of the entries it was meant to.
Removing the test for *nptr resolves the issue.
It would have helped immensely if the backtrace for load_images actually
mentioned the test for nptr and showed how it could cause an early exit from
the allocation routine. As is, the diagnostics were definitely unhelpful.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181112/a4d95e13/attachment.html>
More information about the llvm-bugs
mailing list