Module Name:    src
Committed By:   thorpej
Date:           Sat Dec 19 07:47:23 UTC 2009

Modified Files:
        src/external/bsd/libelf/dist: _libelf.h

Log Message:
LIBELF_COPY_U32(), LIBELF_COPY_S32(): Make sure that the SRC values are
being compared as the maximum width and appropriate signed-ness.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/dist/_libelf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/_libelf.h
diff -u src/external/bsd/libelf/dist/_libelf.h:1.2 src/external/bsd/libelf/dist/_libelf.h:1.3
--- src/external/bsd/libelf/dist/_libelf.h:1.2	Sat Dec 19 05:55:37 2009
+++ src/external/bsd/libelf/dist/_libelf.h	Sat Dec 19 07:47:22 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: _libelf.h,v 1.2 2009/12/19 05:55:37 thorpej Exp $	*/
+/*	$NetBSD: _libelf.h,v 1.3 2009/12/19 07:47:22 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -140,7 +140,7 @@
 };
 
 #define	LIBELF_COPY_U32(DST,SRC,NAME)	do {		\
-		if ((SRC)->NAME > UINT_MAX) {		\
+		if ((uint64_t)(SRC)->NAME > UINT_MAX) {	\
 			LIBELF_SET_ERROR(RANGE, 0);	\
 			return (0);			\
 		}					\
@@ -148,8 +148,8 @@
 	} while (/*CONSTCOND*/0)
 
 #define	LIBELF_COPY_S32(DST,SRC,NAME)	do {		\
-		if ((SRC)->NAME > INT_MAX ||		\
-		    (SRC)->NAME < INT_MIN) {		\
+		if ((int64_t)(SRC)->NAME > INT_MAX ||	\
+		    (int64_t)(SRC)->NAME < INT_MIN) {	\
 			LIBELF_SET_ERROR(RANGE, 0);	\
 			return (0);			\
 		}					\

Reply via email to