Project

General

Profile

Bug #4157

operator>=(bufferlist& l, bufferlist& r) throws on a >= ab

Added by Loic Dachary over 6 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
common
Target version:
-
Start date:
02/15/2013
Due date:
% Done:

90%

Spent time:
Source:
Development
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:

Description

  bufferlist a;
  a.append("A");
  bufferlist ab;
  ab.append("AB");
  a >= ab

throws with
terminate called after throwing an instance of 'ceph::buffer::end_of_buffer'

Related issues

Blocks Ceph - Tasks #4066: unit tests for src/include/buffer.h Resolved 02/09/2013 02/16/2013

Associated revisions

Revision c4573b74 (diff)
Added by Loic Dachary over 6 years ago

fix operator>=(bufferlist& l, bufferlist& r)

bufferlist a;
a.append("A");
bufferlist ab;
ab.append("AB");

a >= ab failed, throwing an instance of 'ceph::buffer::end_of_buffer'
because it tried to access a1. All comparison operators should be
tested using a lexicographic sort like strcmp or memcmp (-1, 0, 1).
In the meantime, the missing test is added:

if (l.length() == p && r.length() > p) return false;

A set of unit tests demonstrating the problem and covering all comparison
operators are added to show that the proposed fix works as expected.

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

Signed-off-by: Loic Dachary <>

History

#1 Updated by Loic Dachary over 6 years ago

  • Status changed from In Progress to Need Review

#2 Updated by Loic Dachary over 6 years ago

  • % Done changed from 0 to 90

The pull request is closed
Minimal patch sent via email http://marc.info/?l=ceph-devel&m=136100588219116&w=4

#3 Updated by Sage Weil over 6 years ago

  • Status changed from Need Review to Resolved

Also available in: Atom PDF