Revision: 69013
http://sourceforge.net/p/brlcad/code/69013
Author: brlcad
Date: 2016-10-11 03:37:24 +0000 (Tue, 11 Oct 2016)
Log Message:
-----------
this may be wrong in the general case (where magic is not the first struct
entry), but it's definitely not right to check sizeof() a type different than
what we're casting against. doesn't check all the lower bits whens size_t is
smaller than a pointer.
Modified Paths:
--------------
brlcad/trunk/src/libbu/badmagic.c
Modified: brlcad/trunk/src/libbu/badmagic.c
===================================================================
--- brlcad/trunk/src/libbu/badmagic.c 2016-10-11 02:38:23 UTC (rev 69012)
+++ brlcad/trunk/src/libbu/badmagic.c 2016-10-11 03:37:24 UTC (rev 69013)
@@ -35,7 +35,7 @@
if (UNLIKELY(!(ptr))) {
snprintf(buf, MAGICBUFSIZ, "ERROR: NULL %s pointer, file %s, line %d\n",
str, file, line);
- } else if (UNLIKELY(((size_t)(ptr)) & (sizeof(uint32_t)-1))) {
+ } else if (UNLIKELY(((size_t)(ptr)) & (sizeof(size_t)-1))) {
snprintf(buf, MAGICBUFSIZ, "ERROR: %p mis-aligned %s pointer, file %s,
line %d\n",
(void *)ptr, str, file, line);
} else if (UNLIKELY(*(ptr) != (uint32_t)(magic))) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits