From d6ff3f1479f6cb4e436f721a9b0408073ae4e494 Mon Sep 17 00:00:00 2001 From: thorpej Date: Sat, 19 Dec 2009 07:47:22 +0000 Subject: [PATCH] LIBELF_COPY_U32(), LIBELF_COPY_S32(): Make sure that the SRC values are being compared as the maximum width and appropriate signed-ness. --- external/bsd/libelf/dist/_libelf.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/external/bsd/libelf/dist/_libelf.h b/external/bsd/libelf/dist/_libelf.h index 9f9cdacacd04..a682150f39ee 100644 --- a/external/bsd/libelf/dist/_libelf.h +++ b/external/bsd/libelf/dist/_libelf.h @@ -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 @@ enum { }; #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 @@ enum { } 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); \ } \