Skip to content

Commit 5ea57d8

Browse files
committed
CQ shared: Fix off-by-nine error leading to lost messages
And `eof` crashes. The problem is that we may end up trying to read more data from the file when scanning, despite being at the end of the file. This results in the current Acc to be returned instead of the remaining data being parsed.
1 parent 1e3e58a commit 5ea57d8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

deps/rabbit/src/rabbit_msg_store.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,7 @@ scan_data(<<Size:64, MsgIdInt:128, _Rest/bits>> = Data, Fd, Fun, Offset, FileSiz
15991599
end;
16001600
%% This might be the start of a message.
16011601
scan_data(<<Size:64, Rest/bits>> = Data, Fd, Fun, Offset, FileSize, MsgIdsFound, Acc)
1602-
when byte_size(Rest) < Size + 1, Size < FileSize - Offset ->
1602+
when byte_size(Rest) < Size + 1, Size + 9 < FileSize - Offset ->
16031603
scan(Data, Fd, Fun, Offset, FileSize, MsgIdsFound, Acc);
16041604
scan_data(Data, Fd, Fun, Offset, FileSize, MsgIdsFound, Acc)
16051605
when byte_size(Data) < 8 ->

0 commit comments

Comments
 (0)