mirror of
https://github.com/github/codeql.git
synced 2026-05-13 02:39:26 +02:00
17 lines
410 B
Ruby
17 lines
410 B
Ruby
class UsersController < ActionController::Base
|
|
def example_zlib_inflate
|
|
MAX_ALLOWED_CHUNK_SIZE = 256
|
|
MAX_ALLOWED_TOTAL_SIZE = 1024
|
|
|
|
user_data = params[:data]
|
|
output = []
|
|
outsize = 0
|
|
|
|
Zlib::Inflate.inflate(user_data) { |chunk|
|
|
outsize += chunk.size
|
|
if chunk.size < MAX_ALLOWED_CHUNK_SIZE && outsize < MAX_ALLOWED_TOTAL_SIZE
|
|
output << chunk
|
|
end
|
|
}
|
|
end
|
|
end |