diff options
author | Mike Pall <mike> | 2016-04-24 17:32:12 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2016-04-24 17:32:12 +0200 |
commit | ac42037db0ea0e0c8f4934b5103db522ab405129 (patch) | |
tree | be659548215b60726dfd6f34c1fdf545d81a7b1a /src/lj_obj.h | |
parent | d8ac6230ed95a60b79e58a4aa2ba7f6d0b132e9e (diff) | |
download | luajit-ac42037db0ea0e0c8f4934b5103db522ab405129.tar.gz luajit-ac42037db0ea0e0c8f4934b5103db522ab405129.tar.bz2 luajit-ac42037db0ea0e0c8f4934b5103db522ab405129.zip |
Constrain value range of lj_ir_kptr() to unsigned 32 bit pointers.
Thanks to Peter Cawley.
Diffstat (limited to 'src/lj_obj.h')
-rw-r--r-- | src/lj_obj.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lj_obj.h b/src/lj_obj.h index 059eb132..25da9455 100644 --- a/src/lj_obj.h +++ b/src/lj_obj.h | |||
@@ -843,12 +843,16 @@ static LJ_AINLINE void setlightudV(TValue *o, void *p) | |||
843 | #endif | 843 | #endif |
844 | 844 | ||
845 | #if LJ_FR2 | 845 | #if LJ_FR2 |
846 | #define setcont(o, f) ((o)->u64 = (uint64_t)(uintptr_t)(void *)(f)) | 846 | #define contptr(f) ((void *)(f)) |
847 | #define setcont(o, f) ((o)->u64 = (uint64_t)(uintptr_t)contptr(f)) | ||
847 | #elif LJ_64 | 848 | #elif LJ_64 |
849 | #define contptr(f) \ | ||
850 | ((void *)(uintptr_t)(uint32_t)((intptr_t)(f) - (intptr_t)lj_vm_asm_begin)) | ||
848 | #define setcont(o, f) \ | 851 | #define setcont(o, f) \ |
849 | ((o)->u64 = (uint64_t)(void *)(f) - (uint64_t)lj_vm_asm_begin) | 852 | ((o)->u64 = (uint64_t)(void *)(f) - (uint64_t)lj_vm_asm_begin) |
850 | #else | 853 | #else |
851 | #define setcont(o, f) setlightudV((o), (void *)(f)) | 854 | #define contptr(f) ((void *)(f)) |
855 | #define setcont(o, f) setlightudV((o), contptr(f)) | ||
852 | #endif | 856 | #endif |
853 | 857 | ||
854 | #define tvchecklive(L, o) \ | 858 | #define tvchecklive(L, o) \ |