fix ByteStreamBuffer

pull/8645/head
Brian Armstrong 8 years ago
parent fe21487f91
commit 40dc0bcd63
  1. 12
      modules/imgcodecs/src/loadsave.cpp

@ -70,21 +70,21 @@ protected:
std::ios_base::seekdir dir,
std::ios_base::openmode )
{
// get absolute offset
off_type off = offset;
char* whence = eback();
if (dir == std::ios_base::cur)
{
off += gptr() - eback();
whence = gptr();
}
else if (dir == std::ios_base::end)
{
off += egptr() - eback();
whence = egptr();
}
char* to = whence + offset;
// check limits
if (off >= (off_type)0 && off <= egptr() - eback())
if (to >= eback() && to <= egptr())
{
setg(eback(), gptr() + off, egptr());
setg(eback(), to, egptr());
return gptr() - eback();
}

Loading…
Cancel
Save