X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4db97e24f5e2ad38970c55148ddb807399ecd191..c29c95fe24973b94fd724db767193171ca7c513d:/samples/docview/doc.cpp diff --git a/samples/docview/doc.cpp b/samples/docview/doc.cpp index 24f3984b16..e093d82ae3 100644 --- a/samples/docview/doc.cpp +++ b/samples/docview/doc.cpp @@ -79,6 +79,16 @@ DocumentIstream& DrawingDocument::LoadObject(DocumentIstream& istream) wxInt32 count = 0; stream >> count; + if ( count < 0 ) + { + wxLogWarning("Drawing document corrupted: invalid segments count."); +#if wxUSE_STD_IOSTREAM + istream.clear(std::ios::badbit); +#else + istream.Reset(wxSTREAM_READ_ERROR); +#endif + return istream; + } for ( int n = 0; n < count; n++ ) {