+2004-06-15 Ken Raeburn <raeburn@mit.edu>
+
+ * mpool/mpool.c (mpool_get, mpool_write): Check that the offset
+ calculation didn't overflow.
+
2004-06-11 Ken Raeburn <raeburn@mit.edu>
* Makefile.in (include/generated.stmp): New intermediate target
++mp->pageread;
#endif
off = mp->pagesize * pgno;
+ if (off / mp->pagesize != pgno) {
+ /* Run past the end of the file, or at least the part we
+ can address without large-file support? */
+ errno = E2BIG;
+ return NULL;
+ }
if (lseek(mp->fd, off, SEEK_SET) != off)
return (NULL);
(mp->pgout)(mp->pgcookie, bp->pgno, bp->page);
off = mp->pagesize * bp->pgno;
+ if (off / mp->pagesize != bp->pgno) {
+ /* Run past the end of the file, or at least the part we
+ can address without large-file support? */
+ errno = E2BIG;
+ return RET_ERROR;
+ }
if (lseek(mp->fd, off, SEEK_SET) != off)
return (RET_ERROR);
if (write(mp->fd, bp->page, mp->pagesize) != mp->pagesize)