Issue 20184 - Fix problems detected with valgrind
Summary: Fix problems detected with valgrind
Status: CLOSED FIXED
Alias: None
Product: porting
Classification: Code
Component: code (show other issues)
Version: current
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: jens-heiner.rechtien
QA Contact: issues@porting
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-26 13:20 UTC by jens-heiner.rechtien
Modified: 2010-08-25 12:34 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description jens-heiner.rechtien 2003-09-26 13:20:30 UTC
Make OOo as "valgrind clean" as possible.
Comment 1 jens-heiner.rechtien 2003-09-26 13:21:04 UTC
Started.
Comment 2 jens-heiner.rechtien 2003-10-10 15:09:57 UTC
Fixed:

- sal/osl/unx/security.c: overlapping buffers in strncpy() call,     
                    no check of return value of sprintf() 

- vcl/unx/source/app/soicon.cxx: off by one error                        
 
- desktop/source/app/app.cxx: use of uninitialized variable as       
                       in/out parameter in Method call

- tools/source/stream/stream.cxx: unchecked return value of a        
                          read on a stream
                                         
- dtrans/source/X11/X11_selection.cxx: uninitialized member of       
                               SelectionManager

- ucb/source/ucp/file/shell.cxx: use of two uninitialized            
                     stack variables in if clause                    
                    

- sal/rtl/source/uuid.cxx: uninitialized members of oslProcessInfo 
were feeded to random generator

- sal/rtl/source/random.c: in two places were uninitialized stack    
                                     variables/buffers used to enhance
the entropy of the random pool                                        

Comment 3 jens-heiner.rechtien 2003-10-10 18:51:57 UTC
Fixed:

- so3/source/misc/factory.cxx: uninitialized members of SoDll

- sw/source/core/sw3io/sw3imp.cxx: uninitialied member of Sw3IoImp
Comment 4 jens-heiner.rechtien 2003-10-16 15:47:38 UTC
Fixed:

- xmloff/source/style/xmlbahdl.cxx: feed unitialized value to in/out
(5 locations)

- xmloff/source/draw/XMLShapeStyleContext.cxx: no check for possibly
invalidated (-1)index before using it

- sw/source/ui/uiview/view.cxx: methods calls done in ctor before all
members are initialized

- sw/source/core/txtnode/swfont.cxx: member not in all ctors initialized

- sfx2/source/menu/virtmenu.cxx: methods calls done in ctor before all
members are initialized
Comment 5 jens-heiner.rechtien 2003-10-30 17:52:44 UTC
Fixed:

- basic/source/comp/symtbl.cxx: uninitialized local variable

- psprint/source/printer/jobdata.cxx: returned buffer tailored to size
of the memory stream buffer instead of the size of the stream content

Comment 6 jens-heiner.rechtien 2003-11-03 17:00:09 UTC
Fixed:

- sfx2/source/inc/objshimp.hxx: uninitialized member of
SfxObjectShell_Impl

- unotools/source/ucbhelper/ucblockbytes.cxx: wrote uninitialized
buffer to stream
Comment 7 jens-heiner.rechtien 2003-11-05 13:39:19 UTC
Fixed:

- sal/inc/osl/module.hxx: member not in all ctors initialized

- sd/source/ui/app/optsitem.cxx: ca. 60 members of several classes not
proper initialized

- sc/source/ui/docshell/docfunc.cxx: local variable not initialized in
one code path

- xmloff/source/text/txtexppr.cxx: feed uninitialized value to in/out
method parameter
Comment 8 khendricks 2003-11-05 15:13:52 UTC
Hi,

Adding myself to CC on this.

Do you know which versions 680 series or 645 series of builds will see these fixes?

I am hoping that they will make it into 1.1.1 or 1.1.2 as well.

Nice work!

Kevin
Comment 9 jens-heiner.rechtien 2003-11-05 16:52:47 UTC
I'm mostly through with making the OOo smoketest (without Java)
valgrind clean with the default skin (no leak check, though). Only 2
or 3 more contextes to go.

It's planned to integrate this stuff in SRC680 sometime in the next
weeks, after QA. A few of the fixes have already found their way into
1.1.1, but the majority not. I'm thinking about preparing a patch for
the developers to decide if they want to backport certain fixes to OOo
1.1.1. The fixes are small and in general not very risky.

Having the OOo smoketest valgrind clean does not mean that everything
is fine, of course. But with the bulk of contextes out of the way I'll
be able to hand it over to the application developers for a more
thorough testing.
Comment 10 Unknown 2003-11-05 21:04:24 UTC
Heiner, that's really excellent news. 
 
We get a lot of feedback from other folks hacking large 
C++ apps.  From that, it seems the real value in making OOo 
V-clean by default is twofold: 
 
1. It reduces somewhat the tendency to unrepeatable, occasional 
   crashes. 
 
2. Once it is clean, when tracking down a specific bug, its 
   easy to see if the bug has caused memory corruption, and 
   can save many hours figuring out the root cause. 
 
If anything, (2) seems more important than (1). Anyways, 
keep up the good work. 
 
Comment 11 jens-heiner.rechtien 2003-11-06 16:19:36 UTC
Hmm, I wouldn't sneer at 1), too :-)

In fact about a quarter of the found incidences were plain bugs
waiting to jump into the face of the unsuspecting user. The other
incidences are serious, too. They wouldn't cause an immediate failure
of OOo because of some (un?)lucky coincidences they were hidden behind
a logic which always has a valid outcome. Such bugs can be the source
of serious regression if things are reworked. We have seen this kind
of problem all to often. I haven't yet seen another tool which makes
it as easy as valgrind to find this kind of problems.
Comment 12 jens-heiner.rechtien 2003-11-12 18:37:17 UTC
Fixed:

- sw/inc/iodetect.cxx: feed unterminated buffer into method          
                              expecting a zero terminated string 

- sw/source/core/inc/drawfont.hxx: some members of SwDrawTextInfo not
                                         initialized

- i18n/source/GNUcollator/GNUcollator.cxx: local variable not properly
initialized

These are my final fixes for valgrind01, it's now smoketest (java
tests disabled) clean. I've ignored six more contexts which occur in
the run time loader and X11 libraries.
Comment 13 Martin Hollmichel 2004-05-18 10:40:20 UTC
close issue.
Comment 14 Unknown 2010-07-11 23:44:37 UTC
Created attachment 70504
Comment 15 Unknown 2010-08-24 12:03:15 UTC
Created attachment 71273
Comment 16 Unknown 2010-08-25 12:34:23 UTC
Created attachment 71332