]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
ceph-dencoder: select_generated() should properly validate its input
authorAlan Somers <asomers@gmail.com>
Tue, 15 Oct 2013 20:06:06 +0000 (13:06 -0700)
committerSage Weil <sage@inktank.com>
Tue, 15 Oct 2013 20:06:54 +0000 (13:06 -0700)
commit26228ed701870a3625a41f798359d4e550b248b8
treeab024d11d8759cabae8bac0094fbef49c62f4aef
parent8b43d724535ed5b14ee17d3ab6177f8eb3460e68
ceph-dencoder: select_generated() should properly validate its input

If m_list.size() == 0, then calling select_generated(0) will result in
uninitialized data being assigned to m_object, which will cause a segfault
down the road. This patch fixes that.

To Reproduce:
$ ceph-dencoder type MWatchNotify select_test 0 encode decode
Segmentation fault (core dumped)

After the patch:
$ ./ceph-dencoder type MWatchNotify select_test 0 encode decode
error: invalid id for generated object
$ echo $?
1

Fixes: #6510
Signed-off-by: Alan Somers <asomers@gmail.com>
src/test/encoding/ceph_dencoder.cc