axiak/pyre2

Corrupted compiled re2 object causes seg fault

EliezerIsrael opened this issue · 0 comments

This is as much for other users as for the developers.

I'm using re2 in a Django app, and stored a large compiled re2 regex in a Redis cache. When I pulled it out of the cache, the 'pattern' attribute didn't make it out alive - it was 'None'. Naively using the object's 'match' method caused a segmentation fault.

Simple solution - don't store compiled regexs in Redis.

Perhaps there is also room here for the code to fail a bit more gracefully.