1. Georg Brandl
  2. pygments-main
  3. Issues
Issue #671 resolved

potential denial of service vulnerability

Ashley Hewson
created an issue


I've discovered that some accidentally malformed/carefully crafted input can cause pygments to hang using 100% CPU for an arbitrarily long time. The root cause seems to be a slightly badly formed regex in one of the lexers. The problem is trivial to exploit, so I won't give too many details here, but luckily it is also trivial to fix.

== steps to reproduce ==

ask me for $language and bad.in

run pygmentize -l $language bad.in

== expected result == pygmentized output, or at least some kind of error message

== actual output == none... pygmentize hangs with 100% cpu for an arbitrarily long time

== versions affected == I've tried these:

vanilla pygments from easy_install on python 2.6.1 from xcode 4 on OS X snow leopard

latest sources from hg on python python 2.7.1 on ubuntu natty

== how to fix == trivial tweaking of the offending regexp (ask me)

Comments (1)

  1. Log in to comment