vmg / rinku

Autolinking. Ruby. Yes, that's pretty much it.
ISC License
599 stars 67 forks source link

Processes stuck in rinku with 2.0.5 #84

Closed tomhughes closed 5 years ago

tomhughes commented 5 years ago

Upgrading from 2.0.4 to 2.0.5 seems to have caused processes to start getting stuck in an infinite loop processing particular inputs. I captured a stack trace of one that seemed to be stuck:

#0  0x00007f51901e2fb4 in utf8proc_next (pos=<synthetic pointer>, str=0x7f5174cbffa0 "https://www.keepright.atの情報をもとにエラー修正") at utf8.c:73
#1  utf8proc_find_space (str=str@entry=0x7f5174cbffa0 "https://www.keepright.atの情報をもとにエラー修正", pos=59, size=size@entry=60) at utf8.c:106
#2  0x00007f51901e19b4 in autolink__url (link=0x7f51964a6770, data=0x7f5174cbffa0 "https://www.keepright.atの情報をもとにエラー修正", pos=5, size=60, flags=<optimised out>)
    at autolink.c:307
#3  0x00007f51901e2199 in rinku_autolink (ob=ob@entry=0x7f516c763070, text=<optimised out>, size=60, mode=mode@entry=AUTOLINK_URLS, flags=flags@entry=0, 
    link_attr=0x7f518b1c2d89 "rel=\"nofollow\"", link_attr@entry=0x7f518b1c2d88 " rel=\"nofollow\"", skip_tags=0x7f51903e5020 <SKIP_TAGS.9475>, link_text_cb=0x0, payload=0x7f51964a6930)
    at rinku.c:218
#4  0x00007f51901e28eb in rb_rinku_autolink (argc=<optimised out>, argv=<optimised out>, self=<optimised out>) at rinku_rb.c:208
tomhughes commented 5 years ago

Maybe because the change to check_domain means that https://github.com/vmg/rinku/blob/master/ext/rinku/autolink.c#L187 can return false without updating link->end so that nothing is consumed?

kivikakk commented 5 years ago

Thanks for the report, I'll fix this up!

kivikakk commented 5 years ago

2.0.6 has been released, which addresses this. Thanks!