Add the protection to avoid data overflow in BinaryXmlSerializer.java

Add an integer overflow check in the writeShort in these two methods:
1.BinaryXmlSerializer#attributeBytesHex
2.BinaryXmlSerializer#attributeBytesBase64

Bug: 307288067
Test: atest BinaryXmlTest
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:2f04963358987679cb4cbab085ec78c1b5e0ed0e)
Merged-In: I81f5ed43342d5b906f36f3733c2115232da90ac1
Change-Id: I81f5ed43342d5b906f36f3733c2115232da90ac1
2 files changed