Selected versions of Rails 3 contain the SafeBuffer bug. Upgrading to newer versions of Rails can help fix this issue.
Due side effects of some optimizations in the String class, users that directly manipulate SafeBuffer objects via []
and other methods that return new instances of SafeBuffer may be inadvertently marked as HTML safe.