Project

General

Profile

Bug #14229

MemStore: need a guard when read the entire object

Added by xie xingguo over 3 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
01/05/2016
Due date:
% Done:

0%

Source:
Community (dev)
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:

Description

int MemStore::read(
    coll_t cid,
    const ghobject_t& oid,
    uint64_t offset,
    size_t len,
    bufferlist& bl,
    uint32_t op_flags,
    bool allow_eio)
{
  dout(10) << __func__ << " " << cid << " " << oid << " " 
       << offset << "~" << len << dendl;
  CollectionRef c = get_collection(cid);
  if (!c)
    return -ENOENT;

  ObjectRef o = c->get_object(oid);
  if (!o)
    return -ENOENT;
  if (offset >= o->get_size())
    return 0;
  size_t l = len;
  if (l == 0)  // note: len == 0 means read the entire object
    // also need a guard here
    l = o->get_size();

Associated revisions

Revision c07dcd53 (diff)
Added by xie xingguo over 3 years ago

os: put a guard when read the entire object

Otherwise the read operation may overflow.

Fixes: #14229
Signed-off-by: xie xingguo <>

History

#1 Updated by Kefu Chai over 3 years ago

  • Description updated (diff)

Also available in: Atom PDF