Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
05eb181b
Commit
05eb181b
authored
8 years ago
by
kaldoran
Committed by
Simon Désaulniers
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Pht : Fix out of range in isActiveBit function
parent
c08333f2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/opendht/indexation/pht.h
+4
-0
4 additions, 0 deletions
include/opendht/indexation/pht.h
with
4 additions
and
0 deletions
include/opendht/indexation/pht.h
+
4
−
0
View file @
05eb181b
...
...
@@ -52,8 +52,12 @@ struct Prefix {
* @param pos : Pos of the needed bit
* @return : true if the bit is at 1
* false otherwise
* @throw out_of_range Throw out of range if the bit at 'pos' does not exist
*/
bool
isActiveBit
(
size_t
pos
)
const
{
if
(
pos
>=
size_
)
throw
std
::
out_of_range
(
"Can't detect active bit at pos, pos larger than prefix size or empty prefix"
);
return
((
this
->
content_
[
pos
/
8
]
>>
(
7
-
(
pos
%
8
))
)
&
1
)
==
1
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment