From 9da60239c80d7df307d596c5e6ceae88c0146f6d Mon Sep 17 00:00:00 2001 From: sawinglogz <3787776-sawinglogz@users.noreply.gitlab.com> Date: Sun, 5 May 2019 15:45:50 -0400 Subject: [PATCH] Fix memory access error in certain summary files. This currently doesn't make the parsing more complete, it just bails rather than running off the end of memory. --- oscar/SleepLib/loader_plugins/prs1_loader.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/oscar/SleepLib/loader_plugins/prs1_loader.cpp b/oscar/SleepLib/loader_plugins/prs1_loader.cpp index acdc8092..2c1181ee 100644 --- a/oscar/SleepLib/loader_plugins/prs1_loader.cpp +++ b/oscar/SleepLib/loader_plugins/prs1_loader.cpp @@ -2674,6 +2674,10 @@ bool PRS1Import::ParseSummaryF5V3() session->settings[CPAP_PSMin] = minps/10.0f; session->settings[CPAP_PSMax] = maxps/10.0f; + if (hbdata[4].size() < 2) { + qDebug() << "summary missing duration section:" << session->session(); + return false; + } unsigned char * durBlock = (unsigned char *)hbdata[4].data(); summary_duration = durBlock[0] | durBlock[1] << 8;