Closed
Bug 418558
Opened 17 years ago
Closed 7 years ago
Detect use of memcpy/memset on non-POD types
Categories
(Developer Infrastructure :: Source Code Analysis, defect)
Developer Infrastructure
Source Code Analysis
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1411029
People
(Reporter: kinetik, Unassigned)
Details
Attachments
(1 file)
2.60 KB,
text/plain
|
Details |
While working on bug #418172, it occurred to me that being able to detect and warn about some unsafe operations on non-POD types would be very useful. This seems like a useful check that our static analysis tools could perform.
Specifically I was thinking about detecting when a non-POD type is used as the source or destination of a memcpy (what happened in bug #418172 was that a class containing an nsCOMPtr was copying using memcpy, causing a ref counting problem), but there are other cases that would be equally useful to detect (e.g. memset, probably others too).
Updated•17 years ago
|
Status: NEW → ASSIGNED
Comment 1•17 years ago
|
||
Matthew,
Dehydra GCC should be pretty good at detecting these already. Let me know if you want some help in drafting up a script for it.
Reporter | ||
Comment 2•17 years ago
|
||
Assignee: nobody → kinetik
Comment 3•17 years ago
|
||
Looks good. Feel free to file a bug for the member access information or the crashes. The GCC ICEs are probably segfaults within the plugin--at least that's what they always were when I was working on my plugin.
Comment 4•17 years ago
|
||
Oops, looked like Taras already put in the isStatic attributes.
Reporter | ||
Comment 5•17 years ago
|
||
Actually the comment about ICEs in the script is a bit out of date. I was seeing them with an earlier version of the script, but I rewrote the script to be a bit more efficient and haven't seen them since, so I was probably running out of heap with the earlier version. I've run a complete clobber build with the plugin and my script successfully (although I did have to make two Dehydra asserts non-fatal).
I'll be busy for a few days before the freeze, but I'll file bugs on the member access, asserts, and location info soon afterwards.
Reporter | ||
Updated•12 years ago
|
Assignee: kinetik → nobody
Updated•7 years ago
|
Product: Core → Firefox Build System
![]() |
||
Comment 6•7 years ago
|
||
I believe this has mostly been accomplished by bug 1411029, via gcc-8 complaining about such memcpys.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Updated•3 years ago
|
Product: Firefox Build System → Developer Infrastructure
You need to log in
before you can comment on or make changes to this bug.
Description
•