EOVERFLOW in fseek()
Sebastian Huber
sebastian.huber@embedded-brains.de
Wed Jun 20 13:57:00 GMT 2012
Hi,
in "newlib/libc/stdio/fseek.c" we have:
[...]
/*
* We are reading; we can try to optimise.
* Figure out where we are going and where we are now.
*/
if (whence == SEEK_SET)
target = offset;
else
{
#ifdef __USE_INTERNAL_STAT64
if (_fstat64_r (ptr, fp->_file, &st))
#else
if (_fstat_r (ptr, fp->_file, &st))
#endif
goto dumb;
target = st.st_size + offset;
}
if ((long)target != target)
{
ptr->_errno = EOVERFLOW;
_newlib_flockfile_exit (fp);
return EOF;
}
[...]
In "target = st.st_size + offset" we may have a signed integer overflow.
Shouldn't this lead to an EOVERFLOW error?
--
Sebastian Huber, embedded brains GmbH
Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the Newlib
mailing list