Skip to content

Commit a70c47e

Browse files
committed
Merge branch 'RB-10.7'
2 parents f495ce1 + 002c969 commit a70c47e

4 files changed

Lines changed: 34 additions & 3 deletions

File tree

‎Changes‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
10.7.x.x (relative to 10.7.1.1)
1+
10.7.x.x (relative to 10.7.1.2)
22
========
33

4+
5+
10.7.1.2 (relative to 10.7.1.1)
6+
========
7+
8+
Fixes
9+
-----
10+
11+
- IECore.ls() : Fixed error when sequence started with `#`.
12+
413
10.7.1.1 (relative to 10.7.1.0)
514
========
615

‎SConstruct‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ SConsignFile()
5454
ieCoreMilestoneVersion = 10 # for announcing major milestones - may contain all of the below
5555
ieCoreMajorVersion = 7 # backwards-incompatible changes
5656
ieCoreMinorVersion = 1 # new backwards-compatible features
57-
ieCorePatchVersion = 1 # bug fixes
57+
ieCorePatchVersion = 2 # bug fixes
5858
ieCoreVersionSuffix = "" # used for alpha/beta releases. Example: "a1", "b2", etc.
5959

6060
###########################################################################################

‎src/IECore/FileSequenceFunctions.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ void IECore::ls( const std::string &sequencePath, FileSequencePtr &sequence, siz
243243
{
244244
const std::string fileName = it->path().PATH_TO_STRING;
245245

246-
if ( fileName.size() >= std::min( prefix.size(), suffix.size() ) && fileName.substr( 0, prefix.size() ) == prefix && fileName.substr( fileName.size() - suffix.size(), suffix.size() ) == suffix )
246+
if ( fileName.size() >= prefix.size() + suffix.size() && fileName.substr( 0, prefix.size() ) == prefix && fileName.substr( fileName.size() - suffix.size(), suffix.size() ) == suffix )
247247
{
248248
files.push_back( ( dir / boost::filesystem::path( fileName ) ).string() );
249249
}

‎test/IECore/FileSequence.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,28 @@ def testAmbiguousPaddingNonContiguous( self ):
465465
l = IECore.ls( os.path.join( "test", "sequences", "lsTest", "a.###.tif" ) )
466466
self.assertFalse( l )
467467

468+
def testShortFileInDirectory( self ) :
469+
470+
"""A directory entry shorter than the sequence's suffix must not cause a
471+
crash (unsigned underflow in substr) when ls() scans the directory."""
472+
473+
self.tearDown()
474+
os.makedirs( os.path.join( "test", "sequences", "lsTest" ) )
475+
476+
# A sequence with an empty prefix (section before #) and a long suffix (section after)
477+
s = IECore.FileSequence( os.path.join( "test", "sequences", "lsTest", "#_a_very_long_filename.ext" ), IECore.FrameRange( 1, 1 ) )
478+
for f in s.fileNames() :
479+
self.touch( f )
480+
481+
# A file whose name is shorter than the sequence's suffix in the same directory.
482+
# Previously this triggered:
483+
# IndexError: basic_string::substr: __pos (which is 18446744073709551582) > this->size() (which is 4)
484+
self.touch( os.path.join( "test", "sequences", "lsTest", "a.b" ) )
485+
486+
l = IECore.ls( s.fileName, minSequenceSize=1 )
487+
self.assertTrue( l )
488+
self.assertEqual( l.frameList.asList(), [ 1 ] )
489+
468490
def tearDown( self ) :
469491

470492
if os.path.exists( os.path.join( "test", "sequences" ) ) :

0 commit comments

Comments
 (0)