Handle missing SIZE_MAX

Change-Id: Id931f5339e19ce5ff635af93fe9f60f3abebe069