From 625189ce85443f8f78f3f244371916a75e62cc76 Mon Sep 17 00:00:00 2001 From: lostmaniac Date: Tue, 9 Jan 2024 17:03:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=89=E5=85=A8=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=EF=BC=8C=E7=A1=AE=E4=BF=9D=E8=BD=AC=E6=8D=A2=E5=90=8E?= =?UTF-8?q?=E7=9A=84=E5=80=BC=E5=9C=A8int=E7=B1=BB=E5=9E=8B=E7=9A=84?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=E5=86=85=20(#3543)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/recycle_bin.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/app/service/recycle_bin.go b/backend/app/service/recycle_bin.go index 291ee17b4..f2842fa53 100644 --- a/backend/app/service/recycle_bin.go +++ b/backend/app/service/recycle_bin.go @@ -193,6 +193,12 @@ func getRecycleBinDTOFromName(filename string) (*response.RecycleBinDTO, error) if err != nil { return nil, err } + + // 添加安全检查,确保转换后的值在int类型的范围内 + if size < math.MinInt || size > math.MaxInt { + return nil, fmt.Errorf("size out of int range") + } + deleteTime, err := strconv.ParseInt(matches[3], 10, 64) if err != nil { return nil, err