Merge lp:~zorba-coders/zorba/ordpath-bitlength-assert into lp:zorba

Proposed by Ghislain Fourny
Status: Merged
Approved by: Ghislain Fourny
Approved revision: 10885
Merged at revision: 10891
Proposed branch: lp:~zorba-coders/zorba/ordpath-bitlength-assert
Merge into: lp:zorba
Diff against target: 25 lines (+8/-0)
1 file modified
src/store/naive/ordpath.cpp (+8/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/ordpath-bitlength-assert
Reviewer Review Type Date Requested Status
David Graf (community) Approve
Markos Zaharioudakis Approve
Review via email: mp+111413@code.launchpad.net

Commit message

Adding asserts in OrdPath::getLocalBitLength to prevent endless loops and possibly reproduce such a potential endless loop with more information.

Description of the change

Adding asserts in OrdPath::getLocalBitLength to prevent endless loops and possibly reproduce such a potential endless loop with more information.

To post a comment you must log in.
10885. By Ghislain Fourny

Added asserts.

Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
David Graf (davidagraf) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job ordpath-bitlength-assert-2012-06-26T08-53-59.502Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/store/naive/ordpath.cpp'
2--- src/store/naive/ordpath.cpp 2012-06-15 21:31:03 +0000
3+++ src/store/naive/ordpath.cpp 2012-06-21 14:41:21 +0000
4@@ -394,6 +394,10 @@
5 ********************************************************************************/
6 ulong OrdPath::getLocalBitLength(ulong& byteLen) const
7 {
8+ ZORBA_ASSERT_WITH_MSG(isLocal(),
9+ "OrdPath::getLocalBitLength was called even though" <<
10+ "the buffer is remote. This can cause endless loops.");
11+
12 byteLen = getLocalByteLength();
13
14 if (byteLen == 0)
15@@ -409,6 +413,10 @@
16 {
17 lastByte >>= 1;
18 bitLen--;
19+ ZORBA_ASSERT_WITH_MSG(lastByte != 0,
20+ "Enless loop detected in OrdPath::getLocalBitLength." <<
21+ "Value of last byte in local buffer was: " <<
22+ getLocalData()[byteLen - 1]);
23 }
24
25 return bitLen;

Subscribers

People subscribed via source and target branches