From: Antoni Adaszkiewicz Date: Wed, 7 Dec 2022 11:38:48 +0000 (+0100) Subject: upgrade-apply-deltafs: Fix a new files archive decompression bug X-Git-Tag: accepted/tizen/unified/20221220.041635~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e7b35893f230cc1e0dd1d53e57f7a35ac004a4e4;p=platform%2Fcore%2Fsystem%2Fupgrade.git upgrade-apply-deltafs: Fix a new files archive decompression bug In rare cases (in deltas without any diffs) "sysytem.7z" archive file would be the first file in its image directory. In this situation, a wrong offset for the file (relative to delta) would be assumed, and as a result a wrong file would be targeted for decompression. Change-Id: I470854c92f9c0a1afe0bdbae134f4e63347916de --- diff --git a/src/upgrade-apply-deltafs/engine/fota_tar.c b/src/upgrade-apply-deltafs/engine/fota_tar.c index 9452fd9..148f638 100755 --- a/src/upgrade-apply-deltafs/engine/fota_tar.c +++ b/src/upgrade-apply-deltafs/engine/fota_tar.c @@ -232,11 +232,16 @@ int tar_get_cfg_data(tar_info *tar_data) return -1; } - off_t last_seek = 0; + off_t last_seek; int ret; for(;;) { + if ((last_seek = tar_seek(tar_data->tar, 0, SEEK_CUR)) < 0) { + LOGE("seeking error!\n"); + return -1; + } + switch(th_read(tar_data->tar)) { case -1: @@ -265,11 +270,6 @@ int tar_get_cfg_data(tar_info *tar_data) LOGE("tar_skip_regfile() error!\n"); return -1; } - - if ((last_seek = tar_seek(tar_data->tar, 0, SEEK_CUR)) < 0) { - LOGE("seeking error!\n"); - return -1; - } } return 0; }