Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security issue. You can provide wrong size of image. It will countinue read out of buffer range. #52

Open
vird opened this issue Mar 29, 2016 · 0 comments

Comments

@vird
Copy link

vird commented Mar 29, 2016

some coffeescript to test
proper usage

#!/usr/bin/iced
png_encoder = require 'png'
fs  = require 'fs'

local_buffer = new Buffer 2*2*4
local_buffer.fill 0
size_x = 2
size_y = 2

img = new png_encoder.Png(local_buffer, size_x, size_y, "rgba")
img.encode (dst_buf)->
  fs.writeFile "res.png", dst_buf, (err)->

bad usage

#!/usr/bin/iced
png_encoder = require 'png'
fs  = require 'fs'

local_buffer = new Buffer 2*2*4
local_buffer.fill 0
size_x = 2
size_y = 1024

img = new png_encoder.Png(local_buffer, size_x, size_y, "rgba")
img.encode (dst_buf)->
  fs.writeFile "res2.png", dst_buf, (err)->

btw. other modules (node-jpeg, node-gif) also need checking.
png version 3.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant