Merge pull request #10618 from yang-g/fuzz

Fix buffer overflow found by oss-fuzz