Skip to content

Encounter an occasional NSRangeException crash #67

Closed
@xuzhongping

Description

@xuzhongping

Hi, I have an occasional out-of-bounds crash, but I can't give the necessary steps, the scene that comes up has tons of webp animations playing, and I can provide the stack:

#0 Thread

NSRangeException

*** -[__NSFrozenArrayM objectAtIndexedSubscript:]: index 66 beyond bounds for empty array

CoreFoundation
___exceptionPreprocess + 216
3
CoreFoundation
-[__NSFrozenArrayM objectAtIndexedSubscript:] + 120
4
MyAPP
-[SDImageWebPCoder animatedImageDurationAtIndex:] (SDImageWebPCoder.m:0)
5
MyAPP
-[SDAnimatedImage animatedImageDurationAtIndex:] (SDAnimatedImage.m:0)
6
MyAPP
-[SDAnimatedImagePlayer displayDidRefresh:] (SDAnimatedImagePlayer.m:296)
7
MyAPP
-[SDDisplayLink displayLinkDidRefresh:] (SDDisplayLink.m:205)

In addition, I see this code, is there a potential thread insecurity here?

- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index {
    if (index >= _frameCount) {
        return 0;
    }
    if (_frameCount <= 1) {
        return 0;
    }
    return _frames[index].duration;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingincrementalincremental decoding

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions