From 0d890a6821487ef6392c9bff9d8258a4ea85a60f Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 26 Sep 2011 20:32:55 +0000 Subject: [PATCH] Do some minimal sanity checks on the message data. Avoids trying to allocate random amounts of memory when getting an invalid header. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42770 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/debugger/value/value_nodes/BMessageValueNode.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp b/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp index 57ca04db45..65582d31ef 100644 --- a/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp +++ b/src/apps/debugger/value/value_nodes/BMessageValueNode.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include "Architecture.h" @@ -259,6 +260,10 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader, if (error != B_OK) return error; + if (fHeader->format != MESSAGE_FORMAT_HAIKU + || (fHeader->flags & MESSAGE_FLAG_VALID) == 0) + return B_NOT_A_MESSAGE; + if (fIsFlatMessage) what.SetTo(fHeader->what); else