Yuriy Leonov
Yuriy Leonov

Reputation: 504

How to avoid Segmentation fault in pycocotools during decoding of RLE

Here is a sample of decoding corrupted RLE:

from pycocotools import mask  # pycocotools version is 2.0.2
mask.decode({'size': [1024, 1024], 'counts': "OeSOk0[l0VOaSOn0kh0cNmYO'"})

As result it fails with Segmentation fault (core dumped)
It looks like this:

Python 3.6.15 (default) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> from pycocotools import mask
>>> mask.decode({'size': [1024, 1024], 'counts': "OeSOk0[l0VOaSOn0kh0cNmYO'"})
Segmentation fault (core dumped)

Questions:

  1. Is the way to validate RLE(Run-length encoding) before putting it in into mask.decode?
  2. (I think it's not possible, but still) Is the way to handle signal.SIGSEGV and continue executing of code?

Upvotes: 1

Views: 208

Answers (1)

Yuriy Leonov
Yuriy Leonov

Reputation: 504

This issue is solved by updating pycocotools to version 2.0.5

Upvotes: 0

Related Questions