upgrade-apply: Modify to check th_get_size 47/317347/1 accepted/tizen/unified/20250102.161031 accepted/tizen/unified/x/20250102.211258 accepted/tizen/unified/x/asan/20250113.002122
authorSangYoun Kwak <sy.kwak@samsung.com>
Tue, 31 Dec 2024 03:18:26 +0000 (12:18 +0900)
committerSangYoun Kwak <sy.kwak@samsung.com>
Tue, 31 Dec 2024 03:24:28 +0000 (12:24 +0900)
commit707cc79c4d2a385c1403c518d9a7192126d10e60
treeeeb3f231a32c8428c5e6636f4f2fae454c15c937
parent434532841fdbd8dcf433fedecfd0937275cb8474
upgrade-apply: Modify to check th_get_size

The return value of th_get_size() is int type, which means it can be
negative value. Previously, the lvalue of assignment was size_t, which
is unsigned integer while rvalue is the return value of th_get_size().
If the return value is positive, it is ok since size_t contains the
range of positive range of int type. But if it is negative it can be a
problem.(also it is an error)
To resolve this issue, a code to check if the return value is negative
or not before assigning it to size_t type variable.

Change-Id: I947484daca4722d3783964ffb98ea85255998164
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
src/upgrade-apply/patch/patch.c