DiscussionsIssue archiveOCCT:Foundation Classes

Archived issue #0026448

Method Prepend() of sequence breaks it if argument is empty sequence

Open CASCADEOCCT:Foundation Classesclosed5 public notes

Search issues

Description

Method Prepend() of sequence (both TCollection and NCollection) nullifies myFirstItem pointer if argument is empty sequence, thus breaking internal consistency. Depending on a situation, this may lead to crashes or unpredictable behavior.

Steps to reproduce

The following code will cause access violation:

  TColStd_SequenceOfReal aSeq1, aSeq2;
  aSeq1.Append(11.);
  aSeq1.Prepend (aSeq2);
  aSeq1.First(); // access violation here

Public activity

5 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Thu Jul 16 00:34:02 2015 +0300

    0026448: Method Prepend() of sequence breaks it if argument is empty sequence
    
    Check for empty input sequence added in methods Append() and Prepend() of TCollection and NCollection sequences.
    
    Test bugs fclasses bug26448 added
02Commenter 2
Fixed, please review
03Commenter 2
Please test the patch.
04Commenter 4
Dear BugMaster,

Branch CR26448 from occt git-repository (and IR-2015-07-09 from products git-repository) was compiled on Linux and Windows platforms and tested.
[revision removed]

Number of compiler warnings:
occt component:
   Linux: 24 (24 on master)
   Windows: 0 (0 on master)
products component:
   Linux: 37 (37 on master)
   Windows: 0 (0 on master)

Regressions/Differences:
Not detected

Testing cases:
bugs fclasses bug26448 - OK
http://occt-tests/CR26448-IR-2015-07-09-occt-64/Debian70-64/bugs/fclasses/bug26448.html
http://occt-tests/CR26448-IR-2015-07-09-occt-64/Windows-64-VC10/bugs/fclasses/bug26448.html

Testing on Linux:
Total MEMORY difference: 96444024 / 96656180 [-0.22%]
Total CPU difference: 17635.159999999854 / 17412.329999999754 [+1.28%]

Testing on Windows:
Total MEMORY difference: 57149437 / 56532838 [+1.09%]
Total CPU difference: 16311.932562998732 / 15978.823627698926 [+2.08%]
05Commenter 1
Branch [archived branch] has been deleted by Commenter 2.

[revision removed]