mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-04 18:20:42 +00:00
Fix Buffer overrun, causing crash
This commit is contained in:
parent
61d1abee18
commit
fec39bbc3c
@ -204,7 +204,7 @@ FlowParser::FlowParser()
|
||||
m_startsUpper = true;
|
||||
|
||||
// Allocate filter chain buffers..
|
||||
m_filtered = (EventDataType *) malloc(max_filter_buf_size);
|
||||
m_filtered = (EventDataType *) malloc(max_filter_buf_size_malloc);
|
||||
}
|
||||
FlowParser::~FlowParser()
|
||||
{
|
||||
@ -228,7 +228,7 @@ EventDataType *FlowParser::applyFilters(EventDataType *data, int samples)
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_filter_buffers; i++) {
|
||||
m_buffers[i] = (EventDataType *) malloc(max_filter_buf_size);
|
||||
m_buffers[i] = (EventDataType *) malloc(max_filter_buf_size_malloc);
|
||||
}
|
||||
|
||||
int numfilt = m_filters.size();
|
||||
@ -287,9 +287,9 @@ void FlowParser::openFlow(Session *session, EventList *flow)
|
||||
EventStoreType *inraw = flow->rawData();
|
||||
|
||||
// Make sure we won't overflow internal buffers
|
||||
if (m_samples > max_filter_buf_size) {
|
||||
qDebug() << "Error: Sample size exceeds max_filter_buf_size in FlowParser::openFlow().. Capping!!!";
|
||||
m_samples = max_filter_buf_size;
|
||||
if (m_samples > max_filter_buf_size_entries) {
|
||||
qDebug() << "Error: Sample size exceeds max_filter_buf_size_entries in FlowParser::openFlow().. Capping!!!";
|
||||
m_samples = max_filter_buf_size_entries;
|
||||
}
|
||||
|
||||
// Begin with the second internal buffer
|
||||
|
@ -87,7 +87,8 @@ bool operator<(const BreathPeak &p1, const BreathPeak &p2);
|
||||
|
||||
const int num_filter_buffers = 2;
|
||||
|
||||
const int max_filter_buf_size = 2097152 * sizeof(EventDataType);
|
||||
const int max_filter_buf_size_entries = 2097152 ;
|
||||
const int max_filter_buf_size_malloc = max_filter_buf_size_entries * sizeof(EventDataType);
|
||||
|
||||
//! \brief Class to process Flow Rate waveform data
|
||||
class FlowParser
|
||||
|
Loading…
Reference in New Issue
Block a user