diff options
author | Mike Pall <mike> | 2013-03-17 14:20:40 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2013-03-17 14:20:40 +0100 |
commit | d147eedac963f6dfc757d269c180985fd9c0c1e7 (patch) | |
tree | 63f3219e6afa13a72b815560ee90f5ce4d8e55f8 /dynasm | |
parent | eea48c8b263f4fb294200f394764a6eba1de877a (diff) | |
download | luajit-d147eedac963f6dfc757d269c180985fd9c0c1e7.tar.gz luajit-d147eedac963f6dfc757d269c180985fd9c0c1e7.tar.bz2 luajit-d147eedac963f6dfc757d269c180985fd9c0c1e7.zip |
DynASM: Improve validation of local backwards relocations.
Diffstat (limited to 'dynasm')
-rw-r--r-- | dynasm/dasm_arm.h | 3 | ||||
-rw-r--r-- | dynasm/dasm_mips.h | 3 | ||||
-rw-r--r-- | dynasm/dasm_ppc.h | 3 | ||||
-rw-r--r-- | dynasm/dasm_x86.h | 3 |
4 files changed, 8 insertions, 4 deletions
diff --git a/dynasm/dasm_arm.h b/dynasm/dasm_arm.h index 691cfdd7..d83cbbb3 100644 --- a/dynasm/dasm_arm.h +++ b/dynasm/dasm_arm.h | |||
@@ -211,7 +211,8 @@ void dasm_put(Dst_DECL, int start, ...) | |||
211 | case DASM_ALIGN: ofs += (ins & 255); b[pos++] = ofs; break; | 211 | case DASM_ALIGN: ofs += (ins & 255); b[pos++] = ofs; break; |
212 | case DASM_REL_LG: | 212 | case DASM_REL_LG: |
213 | n = (ins & 2047) - 10; pl = D->lglabels + n; | 213 | n = (ins & 2047) - 10; pl = D->lglabels + n; |
214 | if (n >= 0) { CKPL(lg, LG); goto putrel; } /* Bkwd rel or global. */ | 214 | /* Bkwd rel or global. */ |
215 | if (n >= 0) { CK(n>=10||*pl<0, RANGE_LG); CKPL(lg, LG); goto putrel; } | ||
215 | pl += 10; n = *pl; | 216 | pl += 10; n = *pl; |
216 | if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */ | 217 | if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */ |
217 | goto linkrel; | 218 | goto linkrel; |
diff --git a/dynasm/dasm_mips.h b/dynasm/dasm_mips.h index 77a8eb52..0866beb8 100644 --- a/dynasm/dasm_mips.h +++ b/dynasm/dasm_mips.h | |||
@@ -202,7 +202,8 @@ void dasm_put(Dst_DECL, int start, ...) | |||
202 | case DASM_ALIGN: ofs += (ins & 255); b[pos++] = ofs; break; | 202 | case DASM_ALIGN: ofs += (ins & 255); b[pos++] = ofs; break; |
203 | case DASM_REL_LG: | 203 | case DASM_REL_LG: |
204 | n = (ins & 2047) - 10; pl = D->lglabels + n; | 204 | n = (ins & 2047) - 10; pl = D->lglabels + n; |
205 | if (n >= 0) { CKPL(lg, LG); goto putrel; } /* Bkwd rel or global. */ | 205 | /* Bkwd rel or global. */ |
206 | if (n >= 0) { CK(n>=10||*pl<0, RANGE_LG); CKPL(lg, LG); goto putrel; } | ||
206 | pl += 10; n = *pl; | 207 | pl += 10; n = *pl; |
207 | if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */ | 208 | if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */ |
208 | goto linkrel; | 209 | goto linkrel; |
diff --git a/dynasm/dasm_ppc.h b/dynasm/dasm_ppc.h index 774ee6ed..13c44611 100644 --- a/dynasm/dasm_ppc.h +++ b/dynasm/dasm_ppc.h | |||
@@ -202,7 +202,8 @@ void dasm_put(Dst_DECL, int start, ...) | |||
202 | case DASM_ALIGN: ofs += (ins & 255); b[pos++] = ofs; break; | 202 | case DASM_ALIGN: ofs += (ins & 255); b[pos++] = ofs; break; |
203 | case DASM_REL_LG: | 203 | case DASM_REL_LG: |
204 | n = (ins & 2047) - 10; pl = D->lglabels + n; | 204 | n = (ins & 2047) - 10; pl = D->lglabels + n; |
205 | if (n >= 0) { CKPL(lg, LG); goto putrel; } /* Bkwd rel or global. */ | 205 | /* Bkwd rel or global. */ |
206 | if (n >= 0) { CK(n>=10||*pl<0, RANGE_LG); CKPL(lg, LG); goto putrel; } | ||
206 | pl += 10; n = *pl; | 207 | pl += 10; n = *pl; |
207 | if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */ | 208 | if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */ |
208 | goto linkrel; | 209 | goto linkrel; |
diff --git a/dynasm/dasm_x86.h b/dynasm/dasm_x86.h index eb2bc768..c91bfdd5 100644 --- a/dynasm/dasm_x86.h +++ b/dynasm/dasm_x86.h | |||
@@ -213,7 +213,8 @@ void dasm_put(Dst_DECL, int start, ...) | |||
213 | case DASM_REL_LG: | 213 | case DASM_REL_LG: |
214 | case DASM_IMM_LG: | 214 | case DASM_IMM_LG: |
215 | n = *p++; pl = D->lglabels + n; | 215 | n = *p++; pl = D->lglabels + n; |
216 | if (n <= 246) { CKPL(lg, LG); goto putrel; } /* Bkwd rel or global. */ | 216 | /* Bkwd rel or global. */ |
217 | if (n <= 246) { CK(n>=10||*pl<0, RANGE_LG); CKPL(lg, LG); goto putrel; } | ||
217 | pl -= 246; n = *pl; | 218 | pl -= 246; n = *pl; |
218 | if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */ | 219 | if (n < 0) n = 0; /* Start new chain for fwd rel if label exists. */ |
219 | goto linkrel; | 220 | goto linkrel; |