Apply patch for CVE-2013-0155 (Unsafe Query Generation Risk) 

# DO NOT MERGE.  WIP.

from https://groups.google.com/forum/#!msg/ruby-security-ann/niK4drpSHT4/g8JW8ZsayRkJ

@siclait @randomoracle