From 0fe21ba75452299cef0d2b083e2f818dfb23920f Mon Sep 17 00:00:00 2001 From: drl7x Date: Fri, 3 Jan 2003 22:24:22 +0000 Subject: [PATCH] Fixed fatal bug involving bounds checking of expressions of the form sizeof(variable). --- src/Makefile.am | 9 +++------ src/Makefile.in | 8 +++----- src/constraintExpr.c | 6 +++++- src/cpplib.c | 2 ++ 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index b642546..dd1f7f7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -395,6 +395,9 @@ lintnew: splintme splintme: ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(LINTSRC) $(OVERFLOWCHSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw +lintbuffercheck: + ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(LINTSRC) $(OVERFLOWCHSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw +bounds -DLINTBUFFERCHECK + valsplint: valgrind -v --leak-resolution=high --num-callers=20 --show-reachable=no --leak-check=yes ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(LINTSRC) $(OVERFLOWCHSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw @@ -408,12 +411,6 @@ splintsome: splinttest: ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude test.c +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw +keep +supcounts +partial -null - -lintbuffercheck: - ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(LINTSRC) $(LCLSRC) -dump lclint \ - +forcehints -misplacedsharequal +showsourceloc -unrecogcomments \ - -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw +bounds +boundsread +implictconstraint -dLINTBUFFERCHECK - binDir = bin all: splint$(EXEEXT) ../$(top_builddir)/$(binDir)/splint$(EXEEXT) diff --git a/src/Makefile.in b/src/Makefile.in index 79ceee8..6db7488 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1126,6 +1126,9 @@ lintnew: splintme splintme: ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(LINTSRC) $(OVERFLOWCHSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw +lintbuffercheck: + ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(LINTSRC) $(OVERFLOWCHSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw +bounds -DLINTBUFFERCHECK + valsplint: valgrind -v --leak-resolution=high --num-callers=20 --show-reachable=no --leak-check=yes ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(LINTSRC) $(OVERFLOWCHSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw @@ -1138,11 +1141,6 @@ splintsome: splinttest: ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude test.c +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw +keep +supcounts +partial -null -lintbuffercheck: - ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(LINTSRC) $(LCLSRC) -dump lclint \ - +forcehints -misplacedsharequal +showsourceloc -unrecogcomments \ - -supcounts -fcnuse -exportlocal -constuse -mts file -mts filerw +bounds +boundsread +implictconstraint -dLINTBUFFERCHECK - all: splint$(EXEEXT) ../$(top_builddir)/$(binDir)/splint$(EXEEXT) ../$(top_builddir)/$(binDir)/splint$(EXEEXT): splint$(EXEEXT) diff --git a/src/constraintExpr.c b/src/constraintExpr.c index b5c5de4..35dc50a 100644 --- a/src/constraintExpr.c +++ b/src/constraintExpr.c @@ -2384,7 +2384,11 @@ static /*@only@*/ constraintExpr constraintTerm_simpleDivTypeExprNode(/*@only@* } else { - ct2 = qtype_getType (exprData_getType(exprData_getSingle (t1->edata)->edata ) ); + exprNode tempE; + + tempE = exprData_getSingle (t1->edata); + + ct2 = exprNode_getType (tempE); } if (ctype_match (ctype_makePointer(ct2), ct) ) { diff --git a/src/cpplib.c b/src/cpplib.c index 9e35a66..767e60a 100644 --- a/src/cpplib.c +++ b/src/cpplib.c @@ -112,6 +112,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* Warnings for using sprintf - suppress them all for now... */ /*@-bufferoverflowhigh@*/ +/*@-bounds@*/ #define NO_SHORTNAMES @@ -8492,3 +8493,4 @@ void cppBuffer_forward (cppBuffer *buf, int n) } /*@=bufferoverflowhigh@*/ +/*@=bounds@*/ -- 2.45.1