[vtk-developers] Fwd: New Defects reported by Coverity Scan for VTK

Bill Lorensen bill.lorensen at gmail.com
Mon May 16 12:11:08 EDT 2016


BTW, TestXMLWriterWithDataArrayFallback.cxx has been showing up in the
valgrind defects. Also a couple of old valgrind defects are
recurring...
https://open.cdash.org/viewDynamicAnalysis.php?buildid=4367236


On Mon, May 16, 2016 at 11:23 AM, David Lonie <david.lonie at kitware.com> wrote:
> On Mon, May 16, 2016 at 10:10 AM, Ken Martin <ken.martin at kitware.com> wrote:
>>
>> 894           in1 = src1DA->GetComponent(srcTuple1, c);
>> >>>     CID 1355146:  Null pointer dereferences  (NULL_RETURNS)
>> >>>     Dereferencing a pointer that might be null "src2DA" when calling
>> >>> "GetComponent". (The dereference happens because this is a virtual function
>> >>> call.)
>
>
> This actually has a NULL check, but there's a missing return statement. I'll
> fix this up.
>
>>
>> *** CID 1355147:  Resource leaks  (RESOURCE_LEAK)
>>
>> /home/nschloe/software/vtk/source-upstream/IO/XML/Testing/Cxx/TestXMLWriterWithDataArrayFallback.cxx:
>> 32 in TestXMLWriterWithDataArrayFallback(int, char **)()
>> 26     #include "vtkXMLImageDataWriter.h"
>> 27
>> 28     #include <string>
>> 29
>> 30     int TestXMLWriterWithDataArrayFallback(int argc, char *argv[])
>> 31     {
>> >>>     CID 1355147:  Resource leaks  (RESOURCE_LEAK)
>> >>>     Failing to save or free storage allocated by
>> >>> "vtkTestUtilities::GetArgOrEnvOrDefault("-T", argc, argv, "VTK_TEMP_DIR",
>> >>> "Testing/Temporary")" leaks it.
>> 32       std::string temp_dir =
>> std::string(vtkTestUtilities::GetArgOrEnvOrDefault(
>> 33                                            "-T", argc, argv,
>> "VTK_TEMP_DIR",
>> 34                                            "Testing/Temporary"));
>
>
> Pinging TJ -- I'm guessing that the string returned from
> vtkTestUtilities::GetArgOrEnvOrDefault needs to be deleted explicitly by the
> caller.
>
>
>>
>> ** CID 1355148:  Null pointer dereferences  (REVERSE_INULL)
>> /home/nschloe/software/vtk/source-upstream/Common/Core/vtkDataArray.cxx:
>> 1310 in vtkDataArray::CreateDataArray(int)()
>>
>>
>>
>> ________________________________________________________________________________________________________
>> *** CID 1355148:  Null pointer dereferences  (REVERSE_INULL)
>> /home/nschloe/software/vtk/source-upstream/Common/Core/vtkDataArray.cxx:
>> 1310 in vtkDataArray::CreateDataArray(int)()
>> 1304
>> 1305
>> //----------------------------------------------------------------------------
>> 1306     vtkDataArray* vtkDataArray::CreateDataArray(int dataType)
>> 1307     {
>> 1308       vtkAbstractArray* aa = vtkAbstractArray::CreateArray(dataType);
>> 1309       vtkDataArray* da = vtkDataArray::FastDownCast(aa);
>> >>>     CID 1355148:  Null pointer dereferences  (REVERSE_INULL)
>> >>>     Null-checking "aa" suggests that it may be null, but it has
>> >>> already been dereferenced on all paths leading to the check.
>> 1310       if (!da && aa)
>> 1311         {
>> 1312         // Requested array is not a vtkDataArray. Delete the
>> allocated array.
>> 1313         aa->Delete();
>> 1314         }
>> 1315       return da;
>
>
> This has been fixed since the coverty scan last ran -- FastDownCast will
> NULL check its argument after d97bea99f (just merged last week).
>
> Dave
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>
>



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the vtk-developers mailing list