0

DumpWithoutCrashing when trust token params deserialization fails

crbug.com/1062637 reported URLLoaderFactory
VALIDATION_ERROR_DESERIALIZATION_FAILED crashes starting shortly after
adding a new member to ResourceRequest. The new member, of type
OptionalTrustTokenParams, is only used for functionality currently
behind a flag (and not enabled anywhere in production).

To help diagnose the cause of the crash (and, in particular, whether
it has to do with the trust_token_params field) this change separates
the deserialization of this field from the large "if (!Read(A) ||
!Read(B) || ...)" conditional in url_request_mojom_traits.cc and
specifically dumps on failure to deserialize the field.

R=yhirano

Bug: 1062637
Change-Id: Icc199fe29bcf1179d762971fb383ffee95b31ee9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2119764
Commit-Queue: David Van Cleve <davidvc@chromium.org>
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754090}
This commit is contained in:
David Van Cleve
2020-03-27 18:11:24 +00:00
committed by Commit Bot
parent 071d8142ed
commit c88237d6d1

@ -6,6 +6,7 @@
#include <vector>
#include "base/debug/dump_without_crashing.h"
#include "base/logging.h"
#include "mojo/public/cpp/base/file_mojom_traits.h"
#include "mojo/public/cpp/base/file_path_mojom_traits.h"
@ -187,11 +188,19 @@ bool StructTraits<
!data.ReadThrottlingProfileId(&out->throttling_profile_id) ||
!data.ReadFetchWindowId(&out->fetch_window_id) ||
!data.ReadDevtoolsRequestId(&out->devtools_request_id) ||
!data.ReadRecursivePrefetchToken(&out->recursive_prefetch_token) ||
!data.ReadTrustTokenParams(&out->trust_token_params.as_ptr())) {
!data.ReadRecursivePrefetchToken(&out->recursive_prefetch_token)) {
// Note that data.ReadTrustTokenParams is temporarily handled below.
return false;
}
// Temporarily separated from the remainder of the deserialization in order to
// help debug crbug.com/1062637.
if (!data.ReadTrustTokenParams(&out->trust_token_params.as_ptr())) {
// We don't return false here to avoid duplicate reports.
out->trust_token_params = base::nullopt;
base::debug::DumpWithoutCrashing();
}
out->attach_same_site_cookies = data.attach_same_site_cookies();
out->update_first_party_url_on_redirect =
data.update_first_party_url_on_redirect();