How to avoid Segmentation fault in pycocotools during decoding of RLE

Question:

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?
Asked By: Yuriy Leonov

||

Answers:

This issue is solved by updating pycocotools to version 2.0.5

Answered By: Yuriy Leonov
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.