Skip to content

Commit 104f702

Browse files
committed
FIX: Fix live client upgrading buffer shift
1 parent b280855 commit 104f702

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Bug fixes
66
- Removed `Intraday` variant from `DatasetCondition` enum
7+
- Fixed potential corrupted records when upgrading DBN versions in live clients
78

89
## 0.38.2 - 2025-07-01
910

src/live_blocking.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,12 @@ const databento::Record* LiveBlocking::NextRecord(
189189
}
190190
}
191191
current_record_ = Record{BufferRecordHeader()};
192-
buffer_.Consume(current_record_.Size());
192+
const auto bytes_to_consume = current_record_.Size();
193193
current_record_ =
194194
DbnDecoder::DecodeRecordCompat(version_, upgrade_policy_, send_ts_out_,
195195
&compat_buffer_, current_record_);
196+
// Can't consume til after upgrade as Consume may shift
197+
buffer_.Consume(bytes_to_consume);
196198
return &current_record_;
197199
}
198200

0 commit comments

Comments
 (0)