bugGNU Octave - Bugs: bug #43383, Fix using uninitialized variable...

 
 

bug #43383: Fix using uninitialized variable (idx-vector.cc)

Submitted by:  PrasannaKumar Muralidharan <prasannatsm>
Submitted on:  Wed 08 Oct 2014 05:24:49 PM UTC  
 
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: Wont FixAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 10 Oct 2014 06:23:18 AM UTC, comment #2:

Oops. Should have multiplied with size.

Anyway if len denotes the number of non-zero elements in 'data' this patch is not necessary at all.

PrasannaKumar Muralidharan <prasannatsm>
Thu 09 Oct 2014 09:45:08 PM UTC, comment #1:

I think you are using memset incorrectly here. The last argument is the number of bytes, so I think you should be multiplying by sizeof. But since this is C++ code, maybe it would be better to use std::fill?

But in any case, I think the static analysis is showing a false positive here because len is equal to the number of non-zero elements in the data vector, so the loop should set all elements of idata.

John W. Eaton <jwe>
Project Administrator
Wed 08 Oct 2014 05:24:49 PM UTC, original submission:

Attached patch fixes usage of uninitialised variable.

PrasannaKumar Muralidharan <prasannatsm>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Updated the item)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by bpabbott (Updated the item)
  • -unavailable- added by prasannatsm (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 22 Oct 2014 04:18:41 AM UTCrik5StatusNone=>Wont Fix
      Open/ClosedOpen=>Closed
    Thu 09 Oct 2014 05:31:16 PM UTCbpabbottSummaryFix using uninitialised variable=>Fix using uninitialized variable (idx-vector.cc)
    Wed 08 Oct 2014 05:24:49 PM UTCprasannatsmAttached File-=>Added fix_uninitialised_memory_access_idx-vector_cc.diff, #32242

    Back to the top


    Powered by Savane 3.1-cleanup1