author Ted Campbell <>
Tue, 28 Nov 2017 23:01:49 -0500
changeset 442685 84ca5dce1d6a63bc64612876eccee30fc45080f9
parent 397426 873ccd759d932a973695329530a3fedf423997ad
child 465084 921a6c4f71224fc825aff96f6f4461a83e5d2883
permissions -rw-r--r--
Bug 1418894 - Harden XDR data decoding. r=nbp a=gchang This patch adds better error detection to XDR decoding to reduce memory corruption in the event that XDR data is corrupt (which is not *supposed* to happen). Add missing default cases. Make out-of-range values fail the decode by asserting in debug, and returning a TranscodeError in release. Mix a magic value into enum value before transcoding to buffer (to reduce chance of garbage data being decoded). MozReview-Commit-ID: 1wPkho9dm8c

<!-- Please describe your changes on the following line: -->

<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->