Improve Ipc::Mem page limits accounting (#1030)
Undocumented Ipc::Mem::PageId::maxPurpose is used to mark freed pages.
Freed pages do not participate in estimating future memory needs, so the
Limits array does not need to store their needs. However, some of the
needs estimation code is written without that assumption in mind because
maxPurpose is a legitimate/used purpose value (rather than an enum end
marker). This change improves this code in case our assumption change.
Detected by Coverity:
* CID
1504262: Out-of-bounds write (OVERRUN)
* CID
1504263: Out-of-bounds read (OVERRUN)