libpag
libpag copied to clipboard
Intermittent SIGSEGV crash in `tgfx` module
After upgrading to version 4.3.62, we have encountered an intermittent SIGSEGV crash in the tgfx module. Notably, this issue did not occur in the previous version 4.1.13.
Which Version of libpag are you using?
libpag 4.3.26
What Platform are you on?
- iOS 17.6.1 (21G93)
- iOS 16.7.2 (20H115)
Expected Behavior
No crash
Actual Behavior
Intermittent crash
Code Example
0
SIGSEGV:SEGV_ACCERR
1
0 CoreGraphics A8_mark_constmask(BltDepth const*, BltOp const*, MODE) + 2496
2
1 CoreGraphics A8_mark_inner(BltDepth* const*, BltOp const*) + 212
3
2 CoreGraphics A8_mark_inner(BltDepth* const*, BltOp const*) + 212
4
3 CoreGraphics _RIPLayerBltShape + 1100
5
4 CoreGraphics _ripc_RenderImage + 640
6
5 CoreGraphics _ripc_DrawImage + 904
7
6 CoreGraphics _CGContextDrawImageWithOptions + 1112
8
7 libpag tgfx::CGMask::onFillPath(tgfx::Path const&, tgfx::Matrix const&, bool) (CGMask.cpp:168)
9
8 libpag tgfx::Mask::fillText(tgfx::TextBlob const*, tgfx::Stroke const*) (shared_ptr.h:958)
10
9 libpag pag::DrawMask(tgfx::Context*, pag::Page const&) (shared_ptr.h:958)
11
10 libpag pag::Atlas::Make(tgfx::Context*, std::__1::vector<std::__1::shared_ptr<pag::Glyph>, std::__1::allocator<std::__1::shared_ptr<pag::Glyph> > > const&, int, bool) (TextAtlas.cpp:263)
12
11 libpag pag::TextAtlas::Make(pag::TextBlock const*, pag::RenderCache*, float) (unique_ptr.h:308)
13
12 libpag pag::RenderCache::getTextAtlas(pag::TextBlock const*) (unique_ptr.h:308)
14
13 libpag pag::Text::draw(tgfx::Canvas*, pag::RenderCache*) const (Text.cpp:259)
15
14 libpag pag::SnapshotPicture::makeSnapshot(pag::RenderCache*, float, bool) const (Picture.cpp:205)
16
15 libpag pag::RenderCache::getSnapshot(pag::Picture const*) (unique_ptr.h:303)
17
16 libpag pag::SnapshotPicture::draw(tgfx::Canvas*, pag::RenderCache*) const (Picture.cpp:176)
18
17 libpag pag::MatrixGraphic::draw(tgfx::Canvas*, pag::RenderCache*) const (Graphic.cpp:106)
19
18 libpag pag::LayerGraphic::draw(tgfx::Canvas*, pag::RenderCache*) const (Graphic.cpp:192)
20
19 libpag pag::ClipModifier::applyToGraphic(tgfx::Canvas*, pag::RenderCache*, std::__1::shared_ptr<pag::Graphic>) const (Modifier.cpp:215)
21
20 libpag pag::ModifierGraphic::draw(tgfx::Canvas*, pag::RenderCache*) const (shared_ptr.h:958)
22
21 libpag pag::MatrixGraphic::draw(tgfx::Canvas*, pag::RenderCache*) const (Graphic.cpp:106)
23
22 libpag pag::LayerGraphic::draw(tgfx::Canvas*, pag::RenderCache*) const (Graphic.cpp:192)
24
23 libpag pag::ClipModifier::applyToGraphic(tgfx::Canvas*, pag::RenderCache*, std::__1::shared_ptr<pag::Graphic>) const (Modifier.cpp:215)
25
24 libpag pag::ModifierGraphic::draw(tgfx::Canvas*, pag::RenderCache*) const (shared_ptr.h:958)
26
25 libpag pag::LayerGraphic::draw(tgfx::Canvas*, pag::RenderCache*) const (Graphic.cpp:192)
27
26 libpag pag::ClipModifier::applyToGraphic(tgfx::Canvas*, pag::RenderCache*, std::__1::shared_ptr<pag::Graphic>) const (Modifier.cpp:215)
28
27 libpag pag::ModifierGraphic::draw(tgfx::Canvas*, pag::RenderCache*) const (shared_ptr.h:958)
29
28 libpag pag::MatrixGraphic::draw(tgfx::Canvas*, pag::RenderCache*) const (Graphic.cpp:106)
30
29 libpag pag::ClipModifier::applyToGraphic(tgfx::Canvas*, pag::RenderCache*, std::__1::shared_ptr<pag::Graphic>) const (Modifier.cpp:215)
31
30 libpag pag::ModifierGraphic::draw(tgfx::Canvas*, pag::RenderCache*) const (shared_ptr.h:958)
32
31 libpag pag::PAGSurface::draw(pag::RenderCache*, std::__1::shared_ptr<pag::Graphic>, pag::BackendSemaphore*, bool) (shared_ptr.h:958)
33
32 libpag pag::PAGPlayer::flushInternal(pag::BackendSemaphore*) (PAGPlayer.cpp:304)
34
33 libpag pag::PAGPlayer::flush() (PAGPlayer.cpp:294)
35
34 libpag pag::AnimatorListener::onAnimationUpdate(pag::PAGAnimator*) (PAGAnimator.mm:128)
36
35 libpag pag::PAGAnimator::onFlush(bool) (PAGAnimator.cpp:303)
37
36 libpag std::__1::__function::__func<pag::PAGAnimator::doUpdate(bool)::$_0, std::__1::allocator<pag::PAGAnimator::doUpdate(bool)::$_0>, void ()>::operator()() (shared_ptr.h:176)
38
37 libpag tgfx::Task::execute() (__mutex_base:90)
39
38 libpag tgfx::TaskGroup::RunLoop(tgfx::TaskGroup*) (shared_ptr.h:958)
40
39 libpag void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(tgfx::TaskGroup*), tgfx::TaskGroup*> >(void*) (tuple:191)
41
40 libsystem_pthread.dylib __pthread_start + 116
PAG File
### Tasks
我这里也遇到了类似的问题,libpag v4.3.71,请问这个问题有已解决的版本?
这个crash挂在了访问内存失败上,不一定是具体这个堆栈发生的位置的问题,可能是上层其他的地方有野指针随机写入造成的。这类情况需要有稳定复现的场景才好定位。鉴于这个版本也已经过去了很久了,导致这个野指针的源头很可能已经在其他地方修复过了,但过去修复过了很多的crash,没法明确定位具体是哪个修复。建议先升级到最新的4.4以后版本观察问题是否还存在。这个issue先关闭,如果还有问题可以再打开。