diff options
author | Tom Sepez <tsepez@chromium.org> | 2014-11-06 14:38:12 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2014-11-06 14:38:12 -0800 |
commit | d9ecee1065cf391979dee0051b53fb5ff729ca2e (patch) | |
tree | a96ed4d3577f8415a31f7c26751329587fc41a42 | |
parent | 173f919d0ec99a1a973c9d3a82b474f761d5bce1 (diff) | |
download | pdfium-d9ecee1065cf391979dee0051b53fb5ff729ca2e.tar.xz |
Adding constructor to _FX_SYSTEMTIME to resolve uninitialized read bugs found by /analyze on some error paths
Warning from /analyze was:
src\third_party\pdfium\fpdfsdk\include\fsdk_mgr.h(96) : warning C6001: Using uninitialized memory 'fxtime'.
Other error paths can also lead to reading from an uninitialized _FX_SYSTEMTIME object.
Code-gen for the constructor is small enough (four writes of zeroed EAX with VC++, less with gcc) to make putting the constructor in a .cc file unnecessary.
Approval of in-class member initialization would make this fix simpler but that has not quite been approved yet.
BUG=https://code.google.com/p/pdfium/issues/detail?id=70
BUG=427616
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/692533005
-rw-r--r-- | fpdfsdk/include/fx_systemhandler.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fpdfsdk/include/fx_systemhandler.h b/fpdfsdk/include/fx_systemhandler.h index b9ac413696..e0c362276c 100644 --- a/fpdfsdk/include/fx_systemhandler.h +++ b/fpdfsdk/include/fx_systemhandler.h @@ -13,6 +13,15 @@ typedef void (*TimerCallback)(FX_INT32 idEvent); typedef struct _FX_SYSTEMTIME { + _FX_SYSTEMTIME() + : wYear(0), + wMonth(0), + wDayOfWeek(0), + wDay(0), + wHour(0), + wMinute(0), + wSecond(0), + wMilliseconds(0) {} FX_WORD wYear; FX_WORD wMonth; FX_WORD wDayOfWeek; |