diff options
author | Valentin Gosu <valentin.gosu@gmail.com> | 2018-06-05 16:37:34 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-06-07 15:58:59 +0200 |
commit | 271f1ef600c06a74471665a040c9473d9f7a9a36 (patch) | |
tree | 2d6b969e3e6ebe7537b6c2a83d2a33ae35a128a8 /netwerk/base/nsStandardURL.cpp | |
parent | fa47c8d42743bc39e8501c4652d228cb8023597c (diff) | |
download | UXP-271f1ef600c06a74471665a040c9473d9f7a9a36.tar UXP-271f1ef600c06a74471665a040c9473d9f7a9a36.tar.gz UXP-271f1ef600c06a74471665a040c9473d9f7a9a36.tar.lz UXP-271f1ef600c06a74471665a040c9473d9f7a9a36.tar.xz UXP-271f1ef600c06a74471665a040c9473d9f7a9a36.zip |
Sanity-check in nsStandardURL::Deserialize(). r=mayhemer, a=RyanVM
Also add test for faulty nsStandardURL deserialization.
See Bug 1392739.
Diffstat (limited to 'netwerk/base/nsStandardURL.cpp')
-rw-r--r-- | netwerk/base/nsStandardURL.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/netwerk/base/nsStandardURL.cpp b/netwerk/base/nsStandardURL.cpp index e2a290e4d..dff4ecbc0 100644 --- a/netwerk/base/nsStandardURL.cpp +++ b/netwerk/base/nsStandardURL.cpp @@ -3455,8 +3455,10 @@ FromIPCSegment(const nsACString& aSpec, const ipc::StandardURLSegment& aSegment, return false; } + CheckedInt<uint32_t> segmentLen = aSegment.position(); + segmentLen += aSegment.length(); // Make sure the segment does not extend beyond the spec. - if (NS_WARN_IF(aSegment.position() + aSegment.length() > aSpec.Length())) { + if (NS_WARN_IF(!segmentLen.isValid() || segmentLen.value() > aSpec.Length())) { return false; } |