html2slim icon indicating copy to clipboard operation
html2slim copied to clipboard

hpricot crashes Ruby when input is empty

Open e2 opened this issue 10 years ago • 1 comments

IO.popen("html2slim", 'r+') do |io|
  io.write ""
  io.close_write
  puts io.read
end

Crashes with:

/home/me/.rvm/gems/ruby-2.2.0/gems/hpricot-0.8.6/lib/hpricot/parse.rb:33: [BUG] Segmentation fault at 0x00000000000008
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0015 p:---- s:0071 e:000070 CFUNC  :scan
c:0014 p:0062 s:0066 e:000065 METHOD /home/me/.rvm/gems/ruby-2.2.0/gems/hpricot-0.8.6/lib/hpricot/parse.rb:33
c:0013 p:0026 s:0059 e:000058 METHOD /home/me/.rvm/gems/ruby-2.2.0/gems/hpricot-0.8.6/lib/hpricot/parse.rb:4
c:0012 p:0009 s:0053 e:000052 METHOD /home/me/.rvm/gems/ruby-2.2.0/gems/html2slim-0.1.1/lib/html2slim/converter.rb:11 [FINISH]
c:0

(etc.)

System:

hpricot (0.8.6)
html2slim (0.1.1)
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]

Probably a hpricot issue, but hpricot is no longer maintained AFAIK.

e2 avatar Feb 06 '15 15:02 e2

Could be easily fixed in a PR. Any chance you can try it out?

joaomilho avatar Aug 21 '17 06:08 joaomilho