zhujingguang / pdfium

Automatically exported from code.google.com/p/pdfium
0 stars 0 forks source link

uninitialized variable "integral" is used in core/src/fxge/fx_freetype/fxft2.5.01/src/psaux/psconv.c #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Run pdfium_test on attached file, either under valgrind or msan 
(http://www.chromium.org/developers/testing/memorysanitizer)

==14288== WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f4b558d2087 in PS_Conv_ToFixed third_party/pdfium/core/src/fxge/fx_freetype/src/../fxft2.5.01/src/psaux/psconv.c:275
    #1 0x7f4b558ba581 in ps_parser_load_field third_party/pdfium/core/src/fxge/fx_freetype/src/../fxft2.5.01/src/psaux/psobjs.c:1105
    #2 0x7f4b559799a9 in t1_load_keyword third_party/pdfium/core/src/fxge/fx_freetype/src/../fxft2.5.01/src/type1/t1load.c:1016
    #3 0x7f4b559799a9 in parse_dict third_party/pdfium/core/src/fxge/fx_freetype/src/../fxft2.5.01/src/type1/t1load.c:2001
    #4 0x7f4b5596c8d7 in T1_Open_Face third_party/pdfium/core/src/fxge/fx_freetype/src/../fxft2.5.01/src/type1/t1load.c:2118
    #5 0x7f4b5596c8d7 in T1_Face_Init third_party/pdfium/core/src/fxge/fx_freetype/src/../fxft2.5.01/src/type1/t1objs.c:339
    #6 0x7f4b558464cd in open_face third_party/pdfium/core/src/fxge/fx_freetype/src/../fxft2.5.01/src/base/ftobjs.c:1180

The fix: 

--- a/core/src/fxge/fx_freetype/fxft2.5.01/src/psaux/psconv.c
+++ b/core/src/fxge/fx_freetype/fxft2.5.01/src/psaux/psconv.c
@@ -202,7 +202,7 @@
     FT_INT64  integral = 0;
     FT_INT64  decimal = 0;
 #else
-       FT_Long integral;
+       FT_Long integral = 0;
        FT_Long decimal = 0;
        FT_Int temp0 = 65536;
        FT_Int temp1 = power_ten;

What is the expected output? What do you see instead?

msan and valgrind should be silent

What version of the product are you using? On what operating system?

Please provide any additional information below.

fresh trunk, x86_64 linux

Original issue reported on code.google.com by kcc@chromium.org on 4 Jun 2014 at 1:56

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks, feel free to upload a change using "git cl" and send to one of the cc'd 
foxitsoftware.com addresses for review.

Original comment by jam@chromium.org on 4 Jun 2014 at 3:36

GoogleCodeExporter commented 9 years ago
Fix in f0a5576384e6def4f1fe78d6e0b12b0a9d710bf8

Original comment by bo...@foxitsoftware.com on 5 Jun 2014 at 10:02