facebook / facebook/duckling

Time interval data causing hang (potential regex dos vulnerability)

Ouverte
#338 5 commentaires 5 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Haskell
Étoiles
4.3k
Forks
740
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

While running duckling over a large set of data, I ran across a particular example that caused it to hang reproducibly. Trying to extract `time` from the following text:
```
from 10.00am on Friday 15th April 2016 until 10.00am on Tuesday 19th April 2016
```

This example does not cause a crash or traceback, it just causes an infinite hang until the thread is killed. My best guess is
- a regex dos caused by a badly written pattern
- a recursive call function call

Both clauses (`from` and `until`) need to be present, neither is sufficient to cause a crash on its own. Removing trivial parts of the text allows the function call to return:

```
# empty response (thread killed)
"from 10.00am on Friday 15th April 2016 until 10.00am on Tuesday 19th April 2016"
# very slow
"from 10.00am Friday 15 April 2016 until 10.00am Tuesday 19 April 2016"
# works
"from 10.00am Friday 15 April until 10.00am Tuesday 19 April"
```

---

See #339 for a branch reproducing this case.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.