Mapserver 6.5-dev (or 6.4) getlegendgraphic segfault

Hi, I'm getting segfault when I'm trying to render getlegendgraphic

GDB output: http://pastebin.com/23Y78FHY

LAYER definition: http://pastebin.com/wj6E2YMq

Legend image: http://gis.lesprojekt.cz/legenda.png

Linux distribution is debian wheezy.