File tree Expand file tree Collapse file tree
src/dde-file-manager-daemon/daemonplugin-file-encrypt/encrypt Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -929,7 +929,7 @@ bool block_device_utils::bcMoveFsForward(const QString &device)
929929 return false ;
930930 }
931931 quint64 mvCount = partSize / kStepSize ;
932- if (partSize % kStepSize ) mvCount + = 1 ;
932+ if (partSize % kStepSize == 0 ) mvCount - = 1 ;
933933
934934 // read break point.
935935 auto records = logFile.readAll ().split (' ,' );
@@ -942,6 +942,11 @@ bool block_device_utils::bcMoveFsForward(const QString &device)
942942 quint64 currMovedIndex = lastMovedIndex + 1 ;
943943 for (; currMovedIndex <= mvCount; ++currMovedIndex, ++lastMovedIndex) {
944944 // qInfo() << "moving..." << currMovedIndex << device;
945+ if (currMovedIndex * kStepSize >= partSize) {
946+ qWarning () << " The seek pos is greater than part size!" ;
947+ clearMem ();
948+ break ;
949+ }
945950 // seek current move position
946951 if (!blockFile.seek (currMovedIndex * kStepSize )) {
947952 qWarning () << " seek pos failed!" << currMovedIndex * kStepSize ;
You can’t perform that action at this time.
0 commit comments