Skip to content

Commit 54bc9e3

Browse files
committed
add assertion that first element in handle table actually fits in a jsize
1 parent b2774b1 commit 54bc9e3

File tree

1 file changed

+3
-1
lines changed
  • graalpython/com.oracle.graal.python.jni/src

1 file changed

+3
-1
lines changed

graalpython/com.oracle.graal.python.jni/src/hpy_jni.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ static int32_t unclosedHandleTop = 0;
104104
static HPy unclosedHandles[MAX_UNCLOSED_HANDLES];
105105

106106
static inline jsize get_handle_table_size(HPyContext *ctx) {
107-
return (jsize)HANDLE_TABLE_SIZE(ctx->_private);
107+
uint64_t size = HANDLE_TABLE_SIZE(ctx->_private);
108+
assert((jsize)size == size);
109+
return (jsize)size;
108110
}
109111

110112
static uint64_t get_hpy_handle_for_object(HPyContext *ctx, jobject hpyContext, jobject element, bool update_native_cache) {

0 commit comments

Comments
 (0)