libstagefright: check memory size for overflow before allocation. Bug: 20674086 Change-Id: I431aa2b7d30a942350ab6d105451c6b77e2f99d4 (cherry picked from commit 42cccd7c8811597d56fb86afeacf6231d693dea6)