igrigorik / em-http-request

Asynchronous HTTP Client (EventMachine + Ruby)
1.22k stars 221 forks source link

Prevent data corruption when decoding gzip stream, fixes #284 #301

Closed boxofrad closed 8 years ago

boxofrad commented 8 years ago

Hi! 👋

This fixes an issue where a gzip stream chunked into strangely-sized pieces would result in a buffer overrun when decoding the headers (causing the problem described in #284).

Previously the position where the headers end in compressed was determined by the delta of @pos before and after reading the headers. This didn't take into account the fact that @data may already contain data, but not enough to have advanced @pos on previous iterations.

Thanks for your excellent work on maintaining this project ❤️

igrigorik commented 8 years ago

You sir, are awesome! 👍

boxofrad commented 8 years ago

Aw @igrigorik you're making me blush 😊 Do you think you'll have time to release a new version of the gem with this change soon? (no rush, we can point our Gemfile at the :octocat: repo)

igrigorik commented 8 years ago

@boxofrad done! pushed out 1.1.5. Thanks for your help!