From 8c1028d523242d46cb44ae9ea8273aefdd4fee16 Mon Sep 17 00:00:00 2001 From: chen0088 Date: Fri, 20 Dec 2024 16:15:34 +0800 Subject: [PATCH] modify Signed-off-by: chen0088 --- .../feedingsmoother/derived/dcamera_time_statistician.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/derived/dcamera_time_statistician.cpp b/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/derived/dcamera_time_statistician.cpp index 389bffd1..2b94317d 100644 --- a/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/derived/dcamera_time_statistician.cpp +++ b/services/cameraservice/sourceservice/src/distributedcameramgr/dcameradata/feedingsmoother/derived/dcamera_time_statistician.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -72,6 +72,10 @@ int64_t DCameraTimeStatistician::CalAverValue(int64_t& value, int64_t& valueSum) if (frameIndex_ == FRAME_HEAD) { return 0; } + if (INT64_MAX - valueSum < value) { + DHLOGD("CalAverValue addition overflow."); + return 0; + } valueSum += value; return valueSum / frameIndex_; } -- Gitee