From 5e914781920d6d91d61026cccee352944bbd27f0 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 5 Nov 2008 02:00:07 +0000 Subject: [PATCH] Added sanity check in OSDParser.DeserializeLLSDBinary() to check if the stream is seekable git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2324 52acb1d6-8a22-11de-b505-999d5b087335 --- OpenMetaverse/StructuredData/BinaryLLSD.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenMetaverse/StructuredData/BinaryLLSD.cs b/OpenMetaverse/StructuredData/BinaryLLSD.cs index cb177ba9..999138e0 100644 --- a/OpenMetaverse/StructuredData/BinaryLLSD.cs +++ b/OpenMetaverse/StructuredData/BinaryLLSD.cs @@ -91,11 +91,14 @@ namespace OpenMetaverse.StructuredData /// public static OSD DeserializeLLSDBinary(Stream stream) { + if (!stream.CanSeek) + throw new OSDException("Cannot deserialize binary LLSD from unseekable streams"); + SkipWhiteSpace(stream); bool result = FindByteArray(stream, llsdBinaryHead); if (!result) - throw new OSDException("No binary encoded SD."); + throw new OSDException("Failed to decode binary LLSD"); return ParseLLSDBinaryElement(stream); }