aboutsummaryrefslogtreecommitdiff
path: root/src/unit
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2008-12-29 21:46:03 +0000
committerMike Buland <eichlan@xagasoft.com>2008-12-29 21:46:03 +0000
commit1743bd0eacec94c6f6e3c89e16d0bd6d301017e8 (patch)
treea4de5c4bf9ebb8b9181daa8ec52c697dc3e1ff63 /src/unit
parentf461b3c1839e5cfc85685ed1cb828ecaa74d6912 (diff)
downloadlibbu++-1743bd0eacec94c6f6e3c89e16d0bd6d301017e8.tar.gz
libbu++-1743bd0eacec94c6f6e3c89e16d0bd6d301017e8.tar.bz2
libbu++-1743bd0eacec94c6f6e3c89e16d0bd6d301017e8.tar.xz
libbu++-1743bd0eacec94c6f6e3c89e16d0bd6d301017e8.zip
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.
Diffstat (limited to '')
-rw-r--r--src/unit/taf.cpp16
1 files changed, 16 insertions, 0 deletions
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:
23 addTest( Unit::read1 ); 23 addTest( Unit::read1 );
24 addTest( Unit::encode1 ); 24 addTest( Unit::encode1 );
25 addTest( Unit::emptyStr1 ); 25 addTest( Unit::emptyStr1 );
26 addTest( Unit::incomplete1 );
26 } 27 }
27 28
28 virtual ~Unit() 29 virtual ~Unit()
@@ -108,6 +109,21 @@ public:
108 unitTest( 109 unitTest(
109 mb.getString() == "{\"Test Group\":\n \"Lame\"=\"\"\n}\n" ); 110 mb.getString() == "{\"Test Group\":\n \"Lame\"=\"\"\n}\n" );
110 } 111 }
112
113 void incomplete1()
114 {
115 try
116 {
117 Bu::MemBuf mb("{Lame: \"Hello=\"");
118 Bu::TafReader tr( mb );
119 delete tr.readGroup();
120 unitFailed("Should have thrown an exception, didn't.");
121 }
122 catch( Bu::TafException &e )
123 {
124 // Woot
125 }
126 }
111}; 127};
112 128
113int main( int argc, char *argv[] ) 129int main( int argc, char *argv[] )