From 1743bd0eacec94c6f6e3c89e16d0bd6d301017e8 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 29 Dec 2008 21:46:03 +0000 Subject: Corrected the premature end of stream read corner case in Taf...it was freaking out and allocating all memory, now it just throws an exception. --- src/unit/taf.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/unit') diff --git a/src/unit/taf.cpp b/src/unit/taf.cpp index 3bf7cc6..e4b3ccc 100644 --- a/src/unit/taf.cpp +++ b/src/unit/taf.cpp @@ -23,6 +23,7 @@ public: addTest( Unit::read1 ); addTest( Unit::encode1 ); addTest( Unit::emptyStr1 ); + addTest( Unit::incomplete1 ); } virtual ~Unit() @@ -108,6 +109,21 @@ public: unitTest( mb.getString() == "{\"Test Group\":\n \"Lame\"=\"\"\n}\n" ); } + + void incomplete1() + { + try + { + Bu::MemBuf mb("{Lame: \"Hello=\""); + Bu::TafReader tr( mb ); + delete tr.readGroup(); + unitFailed("Should have thrown an exception, didn't."); + } + catch( Bu::TafException &e ) + { + // Woot + } + } }; int main( int argc, char *argv[] ) -- cgit v1.2.3