Skip to content

Commit

Permalink
Record more data from Windows printer driver failures.
Browse files Browse the repository at this point in the history
Use base::debug::Alias() to record bad DEVMODE return values from
Windows printer drivers.

BUG=780016,806016

Change-Id: I5f2a21db7a17e549139ffef583bf65bcf5c9ef66
Reviewed-on: https://chromium-review.googlesource.com/912755
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#535958}
  • Loading branch information
leizleiz authored and Commit Bot committed Feb 10, 2018
1 parent aa1bd96 commit 1411373
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions printing/backend/win_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <algorithm>
#include <memory>

#include "base/debug/alias.h"
#include "base/file_version_info.h"
#include "base/files/file_path.h"
#include "base/logging.h"
Expand Down Expand Up @@ -514,6 +515,14 @@ std::unique_ptr<DEVMODE, base::FreeDeleter> CreateDevMode(HANDLE printer,

int size = out->dmSize;
int extra_size = out->dmDriverExtra;

// The CHECK_GE() below can fail. Alias the variable values so they are
// recorded in crash dumps.
// See https://crbug.com/780016 and https://crbug.com/806016 for example
// crashes.
base::debug::Alias(&size);
base::debug::Alias(&extra_size);
base::debug::Alias(&buffer_size);
CHECK_GE(buffer_size, size + extra_size);
return out;
}
Expand Down

0 comments on commit 1411373

Please sign in to comment.