Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/libelf/dist LIBELF_COPY_U32(), LIBELF_COPY_S32(...



details:   https://anonhg.NetBSD.org/src/rev/5544b69d89f4
branches:  trunk
changeset: 750161:5544b69d89f4
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Dec 19 07:47:22 2009 +0000

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

diffstat:

 external/bsd/libelf/dist/_libelf.h |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 931ed46165bd -r 5544b69d89f4 external/bsd/libelf/dist/_libelf.h
--- a/external/bsd/libelf/dist/_libelf.h        Sat Dec 19 07:44:27 2009 +0000
+++ b/external/bsd/libelf/dist/_libelf.h        Sat Dec 19 07:47:22 2009 +0000
@@ -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);                     \
                }                                       \



Home | Main Index | Thread Index | Old Index