ceph/src/os
Loic Dachary 77230d434a fix append to uninitialized buffer in FlatIndex::created
The long_name variable is not initialized. When the append_oname
function is called, it will strlen(long_name) and get a result
that depends on the stack content. The long_name is truncated to a
zero length string to prevent this unexpected behavior.

There is no sure way to trigger the problem by writing a unit
test. Unit tests are added for all public methods of the FlatIndex
class. Most of the time the tests fail if the long_name variable is
not properly initialized.

 * uint32_t collection_version()
 * coll_t coll() const
 * void set_ref(std::tr1::shared_ptr<CollectionIndex> ref)
 * int cleanup()
 * int init()
 * int created(const hobject_t &hoid, const char *path)
 * int unlink(const hobject_t &hoid)
 * int lookup(const hobject_t &hoid, IndexedPath *path, int *exist)
 * int collection_list(vector<hobject_t> *ls)
 * int collection_list_partial(const hobject_t &start, int min_count, int max_count, snapid_t seq, vector<hobject_t> *ls, hobject_t *next)

There are a number of border cases that cannot be tested, such as the
logic of the lfn_get static function. Since FlatIndex code is designed
to transition from older namespace conventions, it is difficult to
figure out.

The tests rely on xattr(2) and their availability is checked before
running them.

http://tracker.ceph.com/issues/4542 refs #4542

Signed-off-by: Loic Dachary <loic@dachary.org>
2013-03-26 16:28:06 -04:00
..
btrfs_ioctl.h
chain_xattr.cc
chain_xattr.h
CollectionIndex.h
DBObjectMap.cc DBObjectMap.cc: use empty() instead of size() to check for emptiness 2013-02-13 14:51:28 +01:00
DBObjectMap.h
FileJournal.cc os/FileJournal: fix aio self-throttling deadlock 2013-03-22 09:15:20 -07:00
FileJournal.h FileJournal: add testing methods to corrupt entries 2013-03-15 11:21:07 -07:00
FileStore.cc FileStore::stat: valgrind: don't read *st on error 2013-03-21 18:37:35 -07:00
FileStore.h ObjectStore: add Context management to Transaction 2013-03-13 19:45:12 -07:00
FlatIndex.cc fix append to uninitialized buffer in FlatIndex::created 2013-03-26 16:28:06 -04:00
FlatIndex.h
HashIndex.cc DBObjectMap, hobject: add helpers for pgid bit matching 2013-03-13 19:45:12 -07:00
HashIndex.h HashIndex: fix typo in reset_attr documentation 2012-12-10 17:40:10 -08:00
hobject.cc hobject: fix snprintf args for 32 bit 2013-03-15 17:05:54 -07:00
hobject.h DBObjectMap, hobject: add helpers for pgid bit matching 2013-03-13 19:45:12 -07:00
IndexManager.cc os/IndexManager.cc: reduce scope of 'int r' in IndexManager::build_index() 2013-03-01 16:37:36 +01:00
IndexManager.h
Journal.h FileJournal,Journal: detect some corrupt journal scenarios 2013-03-15 11:21:07 -07:00
JournalingObjectStore.cc os/JournalingObjectStore.cc: prefer prefix ++operator for iterators 2013-03-18 12:35:36 +01:00
JournalingObjectStore.h os/JournalingObjectStore: simplify op_submitting sanity check 2012-12-08 09:32:47 -08:00
KeyValueDB.h
LevelDBStore.cc os: LevelDBStore: scrap init() and create open() and create_and_open() 2013-02-21 18:02:22 +00:00
LevelDBStore.h os/LevelDBStore.h: pass const string by reference to past_prefix() 2013-03-01 16:33:40 +01:00
LFNIndex.cc os/LFNIndex.cc: prefer prefix ++operator for iterators 2013-03-18 12:35:36 +01:00
LFNIndex.h LFNIndex: fix move_subdir comments 2012-12-10 17:45:02 -08:00
ObjectMap.h
ObjectStore.cc FileStore: _split_collection should not create the collection 2013-02-12 10:15:03 -08:00
ObjectStore.h OSD,PG: add upgrade procedure for snap_mapper 2013-03-13 19:45:12 -07:00
SequencerPosition.h