Skip to content

Commit

Permalink
fix: [disk-encrypt] unencrypt part error
Browse files Browse the repository at this point in the history
The seek pos is greater than part size.
add limit for this.

Change-Id: I07839506f171858152ce2865f812714769023d9e
  • Loading branch information
GongHeng2017 authored and deepin-bot[bot] committed Oct 21, 2024
1 parent 067c558 commit b242fa7
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ bool block_device_utils::bcMoveFsForward(const QString &device)
return false;
}
quint64 mvCount = partSize / kStepSize;
if (partSize % kStepSize) mvCount += 1;
if (partSize % kStepSize == 0) mvCount -= 1;

// read break point.
auto records = logFile.readAll().split(',');
Expand All @@ -942,6 +942,11 @@ bool block_device_utils::bcMoveFsForward(const QString &device)
quint64 currMovedIndex = lastMovedIndex + 1;
for (; currMovedIndex <= mvCount; ++currMovedIndex, ++lastMovedIndex) {
// qInfo() << "moving..." << currMovedIndex << device;
if (currMovedIndex * kStepSize >= partSize) {
qWarning() << "The seek pos is greater than part size!";
clearMem();
break;
}
// seek current move position
if (!blockFile.seek(currMovedIndex * kStepSize)) {
qWarning() << "seek pos failed!" << currMovedIndex * kStepSize;
Expand Down

0 comments on commit b242fa7

Please sign in to comment.