From ede632714d571487190df1482e8498d1836cb95c Mon Sep 17 00:00:00 2001 From: neko <52202080+akiyamaneko@users.noreply.github.com> Date: Sat, 3 Oct 2020 17:12:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=BD=9C=E5=9C=A8=E7=9A=84ov?= =?UTF-8?q?erflow=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/hutool/core/collection/ListUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hutool-core/src/main/java/cn/hutool/core/collection/ListUtil.java b/hutool-core/src/main/java/cn/hutool/core/collection/ListUtil.java index fef0bfac6..56814dd95 100644 --- a/hutool-core/src/main/java/cn/hutool/core/collection/ListUtil.java +++ b/hutool-core/src/main/java/cn/hutool/core/collection/ListUtil.java @@ -252,8 +252,8 @@ public class ListUtil { return new ArrayList<>(0); } } - - if ((pageNo * pageSize) > resultSize) { + // 相乘可能会导致越界 临时用long + if (((long)pageNo * pageSize) > resultSize) { // 越界直接返回空 return new ArrayList<>(0); }