Blob Blame History Raw
commit 6a2d8b0b4d49eb5aac600c219e5903420806e56e
Merge: bf12f1d 0c0e7b1
Author: Mike Pall <mike>
Date:   Wed Sep 20 19:42:34 2017 +0200

    Merge branch 'master' into v2.1

From 0c0e7b168ea147866835954267c151ef789f64fb Mon Sep 17 00:00:00 2001
From: Mike Pall <mike>
Date: Wed, 20 Sep 2017 19:39:50 +0200
Subject: [PATCH 16/72] DynASM/x86: Fix potential REL_A overflow.

Thanks to Joshua Haberman.
---
 dynasm/dasm_x86.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dynasm/dasm_x86.h b/dynasm/dasm_x86.h
index 90dc5d1..f9260b0 100644
--- a/dynasm/dasm_x86.h
+++ b/dynasm/dasm_x86.h
@@ -395,7 +395,8 @@ int dasm_encode(Dst_DECL, void *buffer)
 	}
 	case DASM_REL_LG: p++; if (n >= 0) goto rel_pc;
 	  b++; n = (int)(ptrdiff_t)D->globals[-n];
-	case DASM_REL_A: rel_a: n -= (int)(ptrdiff_t)(cp+4); goto wd; /* !x64 */
+	case DASM_REL_A: rel_a:
+	  n -= (unsigned int)(ptrdiff_t)(cp+4); goto wd; /* !x64 */
 	case DASM_REL_PC: rel_pc: {
 	  int shrink = *b++;
 	  int *pb = DASM_POS2PTR(D, n); if (*pb < 0) { n = pb[1]; goto rel_a; }
-- 
2.20.1