From ba46f32c804e665741a6db6f2578a01045304d14 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Sun, 30 Mar 2014 22:31:53 +0200 Subject: deploy some asserts to detect truncated STREAM_SEEK_TO_END Since STREAM_SEEK_TO_END is now 64 bits it could happen that some existing code uses it in some indirect manner and it gets truncated to 32 bits somewhere (on 32 bit platforms); try to detect that with asserts. Of course the checked value is now a valid stream position, so perhaps the checks should eventually be removed. Change-Id: I4248c00d758220bdc3ee94c7aa7a7bd4c86c57f0 --- svl/source/misc/strmadpt.cxx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'svl') diff --git a/svl/source/misc/strmadpt.cxx b/svl/source/misc/strmadpt.cxx index a55a0faa683d..bc7eaac93ca2 100644 --- a/svl/source/misc/strmadpt.cxx +++ b/svl/source/misc/strmadpt.cxx @@ -448,6 +448,8 @@ sal_uLong SvInputStream::GetData(void * pData, sal_uLong nSize) SetError(ERRCODE_IO_CANTREAD); return 0; } + // check if a truncated STREAM_SEEK_TO_END was passed + assert(m_nSeekedFrom != (sal_uInt64)(sal_uInt32)STREAM_SEEK_TO_END); sal_uInt32 nRead = 0; if (m_xSeekable.is()) { @@ -548,6 +550,8 @@ void SvInputStream::FlushData() // virtual sal_uInt64 SvInputStream::SeekPos(sal_uInt64 const nPos) { + // check if a truncated STREAM_SEEK_TO_END was passed + assert(nPos != (sal_uInt64)(sal_uInt32)STREAM_SEEK_TO_END); if (open()) { if (nPos == STREAM_SEEK_TO_END) -- cgit