Skip to content

Commit

Permalink
FarGroupgh-795: FindFile Trap
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed Feb 12, 2024
1 parent 71516e6 commit b5768ec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions far/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
--------------------------------------------------------------------------------
drkns 2024-02-12 01:52:41+00:00 - build 6272

1. gh-795: FindFile Trap.

--------------------------------------------------------------------------------
MZK 2024-02-10 13:13:13-08:00 - build 6271

Expand Down
8 changes: 7 additions & 1 deletion far/findfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,13 @@ bool background_searcher::LookForString(string_view const FileName)
{
// Для UTF-16 (big endian) преобразуем буфер чтения в буфер сравнения
static_assert(std::endian::native == std::endian::little, "No way");
swap_bytes(readBufferA.data(), readBuffer.data(), readBlockSize, sizeof(char16_t));
const auto EvenSize = readBlockSize / sizeof(char16_t) * sizeof(char16_t);
swap_bytes(readBufferA.data(), readBuffer.data(), EvenSize, sizeof(char16_t));
if (readBlockSize & 1)
{
readBuffer[EvenSize / sizeof(char16_t)] = make_integer<char16_t>('\0', static_cast<char>(readBufferA[readBlockSize - 1]));
++bufferCount;
}
// Устанавливаем буфер сравнения
buffer = readBuffer.data();
}
Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6271
6272

0 comments on commit b5768ec

Please sign in to comment.