aboutsummaryrefslogtreecommitdiff
path: root/include/sstream
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-12-24 01:00:43 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-12-24 01:00:43 +0000
commitc900243a09095e1ada97fb2e66ec08f68f277959 (patch)
treea27aa310f08ab03bb4eead4e773d3837c9f46b32 /include/sstream
parent0564cdb94a7a1facbb0dbf888ceb90638aa70ecd (diff)
downloadsrc-c900243a09095e1ada97fb2e66ec08f68f277959.tar.gz
src-c900243a09095e1ada97fb2e66ec08f68f277959.zip
Notes
Notes: svn path=/vendor/libc++/dist/; revision=327128 svn path=/vendor/libc++/libc++-trunk-r321426/; revision=327157; tag=vendor/libc++/libc++-trunk-r321426
Diffstat (limited to 'include/sstream')
-rw-r--r--include/sstream5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/sstream b/include/sstream
index 34b0014c14ad..b01f47b6872c 100644
--- a/include/sstream
+++ b/include/sstream
@@ -577,6 +577,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off,
if ((__wch & (ios_base::in | ios_base::out)) == (ios_base::in | ios_base::out)
&& __way == ios_base::cur)
return pos_type(-1);
+ const ptrdiff_t __hm = __hm_ == nullptr ? 0 : __hm_ - __str_.data();
off_type __noff;
switch (__way)
{
@@ -590,13 +591,13 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off,
__noff = this->pptr() - this->pbase();
break;
case ios_base::end:
- __noff = __hm_ - __str_.data();
+ __noff = __hm;
break;
default:
return pos_type(-1);
}
__noff += __off;
- if (__noff < 0 || __hm_ - __str_.data() < __noff)
+ if (__noff < 0 || __hm < __noff)
return pos_type(-1);
if (__noff != 0)
{