1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-06 01:28:57 +00:00

Merge pull request #668 from TomHarte/OverAllocation

Resolves a potential out-of-bounds array access.
This commit is contained in:
Thomas Harte 2019-11-05 21:52:44 -05:00 committed by GitHub
commit 015f2101f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -229,8 +229,10 @@ void ScanTarget::end_data(size_t actual_length) {
data_type_size_);
// The write area was allocated in the knowledge that there's sufficient
// distance left on the current line, so there's no need to worry about carry.
// distance left on the current line, but there's a risk of exactly filling
// the final line, in which case this should wrap back to 0.
write_pointers_.write_area += actual_length + 1;
write_pointers_.write_area %= write_area_texture_.size();
// Also bookend the end.
memcpy(