fix oss-fuzz issue 11675 (ASSERT: count <= str.len)

Also added an additional error check to avail ()
2 files changed