From 28a78308afad87ac2aa772bdc47949ebc9f684e4 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Thu, 21 Jun 2018 17:09:23 -0500 Subject: [PATCH] Fixed issue with MBR init asserting on bad partition size --- features/filesystem/bd/MBRBlockDevice.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/features/filesystem/bd/MBRBlockDevice.cpp b/features/filesystem/bd/MBRBlockDevice.cpp index a8e74fad72..e83e4fbf07 100644 --- a/features/filesystem/bd/MBRBlockDevice.cpp +++ b/features/filesystem/bd/MBRBlockDevice.cpp @@ -241,7 +241,9 @@ int MBRBlockDevice::init() _size = fromle32(table->entries[_part-1].lba_size) * sector; // Check that block addresses are valid - MBED_ASSERT(_bd->is_valid_erase(_offset, _size)); + if (!_bd->is_valid_erase(_offset, _size)) { + return BD_ERROR_INVALID_PARTITION; + } delete[] buffer; return 0;