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

 
 

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

Submitter:  PrasannaKumar Muralidharan <prasannatsm>
Submitted:  Wed 08 Oct 2014 05:24:49 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Wont Fix Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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 Files:
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-10-22 rik5 StatusNone Wont Fix
        Open/ClosedOpen Closed
    2014-10-09 bpabbott SummaryFix using uninitialised variable Fix using uninitialized variable (idx-vector.cc)
    2014-10-08 prasannatsm Attached File- Added fix_uninitialised_memory_access_idx-vector_cc.diff, #32242

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code