]> sigrok.org Git - pulseview.git/commitdiff
Padded data buffer so that reads do not overrun it.
authorJoel Holdsworth <redacted>
Mon, 1 Apr 2013 07:46:02 +0000 (08:46 +0100)
committerJoel Holdsworth <redacted>
Mon, 8 Apr 2013 18:08:18 +0000 (19:08 +0100)
pv/data/snapshot.cpp

index afd1e43e7c7b3169e792adb4336db4b171fcfd8c..8571dc6623be52b5b4918a2c00c79b52a1b74f6d 100644 (file)
@@ -53,7 +53,8 @@ uint64_t Snapshot::get_sample_count() const
 void Snapshot::append_data(void *data, uint64_t samples)
 {
        lock_guard<recursive_mutex> lock(_mutex);
-       _data = realloc(_data, (_sample_count + samples) * _unit_size);
+       _data = realloc(_data, (_sample_count + samples) * _unit_size +
+               sizeof(uint64_t));
        memcpy((uint8_t*)_data + _sample_count * _unit_size,
                data, samples * _unit_size);
        _sample_count += samples;