[1] Fix potential OOM in PduParser by using stream skip

Avoid allocating a large byte array when skipping values in PduParser.java. Instead of creating a byte array of the given length and reading into it, use InputStream.skip() which is safe and does not allocate memory. This prevents OutOfMemoryErrors when parsing malformed MMS PDUs with huge value lengths.

Additionally, refactored repeated bounds check logic into a helper method `isInvalidLength`.

Added PduParserTest to verify parsing bounds check with huge header lengths.

Bug: 517377150
Flag: EXEMPT BUGFIX
Test: atest MmsTest PduParserTest WapPushOverSmsTest

CONV=9f66c987-4e37-4f71-bbaf-df4cf7f39fd8
TAG=agy
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:4a5fa93a13b6ebfccac598381fa4a4881004bfc9
Merged-In: I46f37df0bd5aa6d75d5043d34b5e831b64b53f57
Change-Id: I46f37df0bd5aa6d75d5043d34b5e831b64b53f57
2 files changed