Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/libraries/fiff/fiff_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1904,6 +1904,15 @@ bool FiffStream::setup_read_raw(QIODevice &p_IODevice,
fiff_int_t first_samp = 0;
fiff_int_t first_skip = 0;
//
// A malformed file may have a raw data block with an empty directory.
// Bail out cleanly instead of indexing past the end of dir below.
//
if (dir.isEmpty())
{
qWarning("No directory entries in raw data block of %s\n", t_sFileName.toUtf8().constData());
return false;
}
//
// Get first sample tag if it is there
//
FiffTag::UPtr t_pTag;
Expand All @@ -1916,7 +1925,7 @@ bool FiffStream::setup_read_raw(QIODevice &p_IODevice,
//
// Omit initial skip
//
if (dir[first]->kind == FIFF_DATA_SKIP)
if (first < dir.size() && dir[first]->kind == FIFF_DATA_SKIP)
{
//
// This first skip can be applied only after we know the buffer size
Expand Down