Unverified Commit 5c399840 authored by Guolin Ke's avatar Guolin Ke Committed by GitHub
Browse files

fix R's overflow (#1960)

parent a2f5c50c
...@@ -124,10 +124,14 @@ typedef union { VECTOR_SER s; double align; } SEXPREC_ALIGN; ...@@ -124,10 +124,14 @@ typedef union { VECTOR_SER s; double align; } SEXPREC_ALIGN;
#define R_INT_PTR(x) ((int *) DATAPTR(x)) #define R_INT_PTR(x) ((int *) DATAPTR(x))
#define R_INT64_PTR(x) ((int64_t *) DATAPTR(x))
#define R_REAL_PTR(x) ((double *) DATAPTR(x)) #define R_REAL_PTR(x) ((double *) DATAPTR(x))
#define R_AS_INT(x) (*((int *) DATAPTR(x))) #define R_AS_INT(x) (*((int *) DATAPTR(x)))
#define R_AS_INT64(x) (*((int64_t *) DATAPTR(x)))
#define R_IS_NULL(x) ((*(LGBM_SE)(x)).sxpinfo.type == 0) #define R_IS_NULL(x) ((*(LGBM_SE)(x)).sxpinfo.type == 0)
// 64bit pointer // 64bit pointer
......
...@@ -474,7 +474,7 @@ LGBM_SE LGBM_BoosterGetNumPredict_R(LGBM_SE handle, ...@@ -474,7 +474,7 @@ LGBM_SE LGBM_BoosterGetNumPredict_R(LGBM_SE handle,
R_API_BEGIN(); R_API_BEGIN();
int64_t len; int64_t len;
CHECK_CALL(LGBM_BoosterGetNumPredict(R_GET_PTR(handle), R_AS_INT(data_idx), &len)); CHECK_CALL(LGBM_BoosterGetNumPredict(R_GET_PTR(handle), R_AS_INT(data_idx), &len));
R_INT_PTR(out)[0] = static_cast<int>(len); R_INT64_PTR(out)[0] = len;
R_API_END(); R_API_END();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment