[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

memory corruption

Roger Pack

10/20/2007 1:29:00 AM

Wondering if anybody's had memory corruption with mingw before. This
works fine for VC and for Linux (it's just some base rails code).
Anyway somehow or other it gets corrupted and inserts random bytes into
a "Buffer"

like \000 and EOF and random junk. It occurs in thsi snippet of erb.rb
code. Any help appreciated :)
-Roger


scanner.scan do |token|
if scanner.stag.nil?
pp "token", token
pp "out", out
case token

when PercentLine
out.push("#{@put_cmd} #{content.dump}") if content.size > 0
content = ''
out.push(token.to_s)
out.cr
when :cr
out.cr
when '<%', '<%=', '<%#'
scanner.stag = token
out.push("#{@put_cmd} #{content.dump}") if content.size > 0
content = ''
when "\n"
content << "\n"
out.push("#{@put_cmd} #{content.dump}")
out.cr
content = ''
when '<%%'
content << '<%'
else
content << token
end
else
case token
when '%>'
case scanner.stag
when '<%'
if content[-1] == ?\n
content.chop!
out.push(content)
out.cr
else
out.push(content)
end
when '<%='
out.push("#{@insert_cmd}((#{content}).to_s)")
when '<%#'
# out.push("# #{content.dump}")
end
scanner.stag = nil
content = ''
when '%%>'
content << '%>'
else
content << token
end
end
end
out.push("#{@put_cmd} #{content.dump}") if content.size > 0
pp "out is", out
out.close
out.script
--
Posted via http://www.ruby-....

1 Answer

Roger Pack

10/20/2007 5:51:00 AM

0

Roger Pack wrote:
> Wondering if anybody's had memory corruption with mingw before. This
> works fine for VC and for Linux (it's just some base rails code).
> Anyway somehow or other it gets corrupted and inserts random bytes into
> a "Buffer"
>
> like \000 and EOF and random junk. It occurs in thsi snippet of erb.rb
> code. Any help appreciated :)
> -Roger
> > out.push("#{@put_cmd} #{content.dump}") if content.size > 0

This line turned out to be the culprit. Rmagick on mingw still had a
'legacy' bug of rewriting String.dump poorly. Rewrote it and rails
works now, in case anyone wonders.
Thanks!
-Roger
--
Posted via http://www.ruby-....