Lots of pdfium bugs found by /analyze |
|||
Issue descriptionI found a batch of /analyze warnings in the pdfium\xfa code that all look legitimate. The first one may not be a bug but we should at least assert that the array is non-empty or, simpler yet, initialize dwID to zero. The others are all bugs, some of them of types that cropped up and were fixed in the non-XFA pdfium code. The /analyzer builder was not working for a few weeks which is why these are coming in late. pdfium\xfa\fwl\lightwidget\cfwl_theme.cpp(64) : warning C6001: Using uninitialized memory 'dwID'. pdfium\xfa\fwl\theme\cfwl_checkboxtp.cpp(174) : warning C6313: Incorrect operator: zero-valued flag cannot be tested with bitwise-and. Use an equality test to check for zero-valued flags. pdfium\xfa\fwl\theme\cfwl_formtp.cpp(86) : warning C6259: Labeled code is unreachable: '(<expression> & 0x3)' in a switch-expr cannot evaluate to '0x80'. pdfium\xfa\fwl\theme\cfwl_formtp.cpp(90) : warning C6259: Labeled code is unreachable: '(<expression> & 0x3)' in a switch-expr cannot evaluate to '0x400'. pdfium\xfa\fwl\theme\cfwl_formtp.cpp(94) : warning C6259: Labeled code is unreachable: '(<expression> & 0x3)' in a switch-expr cannot evaluate to '0x8'. pdfium\xfa\fwl\theme\cfwl_scrollbartp.cpp(55) : warning C6259: Labeled code is unreachable: '(<expression> & 0x3)' in a switch-expr cannot evaluate to '0x80'. pdfium\xfa\fwl\theme\cfwl_scrollbartp.cpp(59) : warning C6259: Labeled code is unreachable: '(<expression> & 0x3)' in a switch-expr cannot evaluate to '0x400'. pdfium\xfa\fwl\theme\cfwl_scrollbartp.cpp(63) : warning C6259: Labeled code is unreachable: '(<expression> & 0x3)' in a switch-expr cannot evaluate to '0x8'. pdfium\xfa\fxbarcode\datamatrix\bc_edifactencoder.cpp(135) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior. pdfium\xfa\fxbarcode\datamatrix\bc_errorcorrection.cpp(124) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior. pdfium\xfa\fxbarcode\datamatrix\bc_errorcorrection.cpp(132) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior. pdfium\xfa\fxbarcode\datamatrix\bc_errorcorrection.cpp(155) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior. pdfium\xfa\fxbarcode\datamatrix\bc_errorcorrection.cpp(182) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior. pdfium\xfa\fxbarcode\datamatrix\bc_highlevelencoder.cpp(81) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior. pdfium\xfa\fxbarcode\datamatrix\bc_symbolinfo.cpp(234) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior. pdfium\xfa\fxbarcode\datamatrix\bc_symbolinfo.cpp(238) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior. pdfium\xfa\fxbarcode\datamatrix\bc_symbolinfo.cpp(240) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior. pdfium\xfa\fxbarcode\datamatrix\bc_symbolinfo.cpp(243) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior. pdfium\xfa\fxbarcode\datamatrix\bc_symbolinfo.cpp(244) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior. pdfium\xfa\fxbarcode\datamatrix\bc_symbolinfo.cpp(246) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior. pdfium\xfa\fxbarcode\datamatrix\bc_symbolinfo.cpp(249) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior. pdfium\xfa\fxbarcode\datamatrix\bc_symbolinfo.cpp(250) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior. pdfium\xfa\fxbarcode\pdf417\bc_pdf417highlevelencoder.cpp(68) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior.
,
May 20 2016
hi, Tom, I can take over this as I am fixing XFA code warnings anyway.
,
May 20 2016
Ok, but a fix to the barcode stuff is in-flight.
,
May 24 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/306588c7b8db5524635eb97559f0b7b76ced0c20 commit 306588c7b8db5524635eb97559f0b7b76ced0c20 Author: thestig <thestig@chromium.org> Date: Tue May 24 01:02:43 2016 Roll PDFium 3cbb6fb..490d612 https://pdfium.googlesource.com/pdfium.git/+log/3cbb6fb..490d612 BUG= 427616 , 613620 , 613623 TBR=ochang@chromium.org Review-Url: https://codereview.chromium.org/2008733002 Cr-Commit-Position: refs/heads/master@{#395498} [modify] https://crrev.com/306588c7b8db5524635eb97559f0b7b76ced0c20/DEPS
,
May 27 2016
The following revision refers to this bug: https://pdfium.googlesource.com/pdfium.git/+/bbff41927ecce2ff93668aa615307f548ca896eb commit bbff41927ecce2ff93668aa615307f548ca896eb Author: weili <weili@chromium.org> Date: Fri May 27 21:48:10 2016 Fix two bugs found by /analyze tool The first one is about bitwise AND on zero, the result would always be zero. The second one is about using wrong bitmasks, the result would cause branches never get executed. BUG= chromium:613623 , chromium:427616 Review-Url: https://codereview.chromium.org/2016243003 [modify] https://crrev.com/bbff41927ecce2ff93668aa615307f548ca896eb/xfa/fwl/theme/cfwl_checkboxtp.cpp [modify] https://crrev.com/bbff41927ecce2ff93668aa615307f548ca896eb/xfa/fwl/theme/cfwl_formtp.cpp
,
Jun 2 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/0191740cd56ba9de20ca1add6964d6b9023fd555 commit 0191740cd56ba9de20ca1add6964d6b9023fd555 Author: ochang <ochang@chromium.org> Date: Thu Jun 02 05:46:03 2016 Roll PDFium d23df55..c324646 https://pdfium.googlesource.com/pdfium.git/+log/d23df55..c324646 BUG= 616248 , 427616 , 613623 , 616246 , 613607 TBR=thestig@chromium.org Review-Url: https://codereview.chromium.org/2034443002 Cr-Commit-Position: refs/heads/master@{#397297} [modify] https://crrev.com/0191740cd56ba9de20ca1add6964d6b9023fd555/DEPS
,
Jun 2 2016
The following revision refers to this bug: https://pdfium.googlesource.com/pdfium.git/+/db444d2063df6c574882d9263e885c4fe1134133 commit db444d2063df6c574882d9263e885c4fe1134133 Author: weili <weili@chromium.org> Date: Thu Jun 02 22:48:15 2016 Fix all the code which has duplicate variable declarations When there are duplicate variable declarations, the inner names shadow the outter ones. This is error prone and harder to read. Remove all the instances found by /analyze. BUG= chromium:613623 , chromium:427616 Review-Url: https://codereview.chromium.org/2027273002 [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/core/fpdfdoc/doc_annot.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/core/fpdftext/fpdf_text_int.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/core/fxcodec/codec/fx_codec_fax.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/core/fxge/dib/fx_dib_composite.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/core/fxge/dib/fx_dib_convert.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/core/fxge/dib/fx_dib_transform.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/core/fxge/ge/fx_ge_device.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/fpdfsdk/formfiller/cffl_iformfiller.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/fpdfsdk/fpdf_flatten.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/fpdfsdk/fpdf_transformpage.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/fpdfsdk/javascript/Field.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/fpdfsdk/pdfwindow/PWL_Edit.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fde/cfde_txtedtengine.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fde/cfx_wordbreak.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fde/tto/fde_textout.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fgas/font/fgas_gefont.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fgas/layout/fgas_rtfbreak.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fgas/layout/fgas_textbreak.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fwl/basewidget/fwl_comboboximp.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fwl/basewidget/fwl_listboximp.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fxbarcode/BC_TwoDimWriter.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fxbarcode/oned/BC_OneDimWriter.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fxfa/app/xfa_ffdocview.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fxfa/app/xfa_ffwidget.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fxfa/app/xfa_textlayout.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fxfa/fm2js/xfa_fmparse.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fxfa/parser/xfa_document_serialize.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fxfa/parser/xfa_layout_itemlayout.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fxfa/parser/xfa_object_imp.cpp [modify] https://crrev.com/db444d2063df6c574882d9263e885c4fe1134133/xfa/fxfa/parser/xfa_script_imp.cpp
,
Jun 3 2016
The following revision refers to this bug: https://pdfium.googlesource.com/pdfium.git/+/12367cb5e83e771cd67948c810fdd5f63d61af87 commit 12367cb5e83e771cd67948c810fdd5f63d61af87 Author: weili <weili@chromium.org> Date: Fri Jun 03 18:22:16 2016 Fix some code which causes warnings when compiled by /analyze tool The code may not cause error conditions, but can be improved. These warnings include uninitialized variables, signed/unsigned mismatch, redundant condition, and using bool in arithmetic operations. Also remove a chunk of unused code. BUG= chromium:613623 , chromium:427616 Review-Url: https://codereview.chromium.org/2036203004 [modify] https://crrev.com/12367cb5e83e771cd67948c810fdd5f63d61af87/core/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp [modify] https://crrev.com/12367cb5e83e771cd67948c810fdd5f63d61af87/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp [modify] https://crrev.com/12367cb5e83e771cd67948c810fdd5f63d61af87/core/fxcodec/codec/fx_codec.cpp [modify] https://crrev.com/12367cb5e83e771cd67948c810fdd5f63d61af87/core/fxcodec/codec/fx_codec_png.cpp [modify] https://crrev.com/12367cb5e83e771cd67948c810fdd5f63d61af87/core/fxcodec/jbig2/JBig2_Context.cpp [modify] https://crrev.com/12367cb5e83e771cd67948c810fdd5f63d61af87/fpdfsdk/fpdf_flatten.cpp [modify] https://crrev.com/12367cb5e83e771cd67948c810fdd5f63d61af87/fpdfsdk/fsdk_baseannot.cpp [modify] https://crrev.com/12367cb5e83e771cd67948c810fdd5f63d61af87/fpdfsdk/javascript/JS_Value.cpp
,
Jun 3 2016
The following revision refers to this bug: https://pdfium.googlesource.com/pdfium.git/+/8d4e0d47f4cd0325be84ebf310fd8de989761939 commit 8d4e0d47f4cd0325be84ebf310fd8de989761939 Author: weili <weili@chromium.org> Date: Fri Jun 03 21:06:36 2016 Fix more bugs found by /analyze tool Three more bugs are discovered: -- potientially used freed pointer; -- potientially used uninitialized variable; -- Used '&&' instead of bitwise operator '&' BUG= chromium:613623 , chromium:427616 Review-Url: https://codereview.chromium.org/2040503002 [modify] https://crrev.com/8d4e0d47f4cd0325be84ebf310fd8de989761939/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp [modify] https://crrev.com/8d4e0d47f4cd0325be84ebf310fd8de989761939/xfa/fwl/core/cfwl_widgetmgr.cpp [modify] https://crrev.com/8d4e0d47f4cd0325be84ebf310fd8de989761939/xfa/fxfa/app/xfa_ffchoicelist.cpp
,
Jun 3 2016
,
Jun 6 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/f1ab43c533e64124ead62d51ded2f91ee2a51181 commit f1ab43c533e64124ead62d51ded2f91ee2a51181 Author: ochang <ochang@chromium.org> Date: Mon Jun 06 17:08:32 2016 Roll PDFium c324646..f7e108b https://pdfium.googlesource.com/pdfium.git/+log/c324646..f7e108b BUG= 427616 , 616253 , 616838 , 613623 TBR=dsinclair@chromium.org TEST=bots Review-Url: https://codereview.chromium.org/2046623002 Cr-Commit-Position: refs/heads/master@{#398052} [modify] https://crrev.com/f1ab43c533e64124ead62d51ded2f91ee2a51181/DEPS |
|||
►
Sign in to add a comment |
|||
Comment 1 by thestig@chromium.org
, May 20 2016Labels: OS-Windows