Enhance bounds check in TextDocumentGenerator
There's too much upstream / logic involved to statically prove info.pages is always >= 0. Better check it at runtime.
CCBUG: 410844