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

crypto/cipher: no padding in cbc causes slice bounds out of range panic #4699

Closed
gopherbot opened this issue Jan 24, 2013 · 2 comments
Closed
Milestone

Comments

@gopherbot
Copy link

by xuxinhua1984:

When creating a cbc encrypter/decrypter (CryptBlocks) it doesn't check "The length
of src must be a multiple of the block size" (for example, I was expecting it to
use "default" padding of all zeros in that case, or some character sequence
delivered by others is dissatisfied the continue, it will panic. see
http://play.golang.org/p/3P1BzW76BC ). Post Go 1 it would likely be better to:

- CryptBlocks returns error, but this will change the signatures of CryptBlocks
- panic if the length of src is not a multiple of the block size, so it is clear where
is the actual error


ps:According to cipher.BlockMode

    // CryptBlocks encrypts or decrypts a number of blocks. The length of
    // src must be a multiple of the block size. Dst and src may point to
    // the same memory.
    CryptBlocks(dst, src []byte)
@rsc
Copy link
Contributor

rsc commented Jan 30, 2013

Comment 1:

Labels changed: added priority-later, removed priority-triage.

Owner changed to @rsc.

Status changed to Started.

@rsc
Copy link
Contributor

rsc commented Jan 30, 2013

Comment 2:

This issue was closed by revision fa2acad.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants