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
c8fcffbe
Commit
c8fcffbe
authored
9 years ago
by
Simon Désaulniers
Committed by
Adrien Béraud
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix possible out of range error in Prefix ctor
parent
63c4eeb9
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/opendht/indexation/pht.h
+13
-10
13 additions, 10 deletions
include/opendht/indexation/pht.h
with
13 additions
and
10 deletions
include/opendht/indexation/pht.h
+
13
−
10
View file @
c8fcffbe
...
@@ -28,10 +28,13 @@ struct Prefix {
...
@@ -28,10 +28,13 @@ struct Prefix {
Prefix
()
{}
Prefix
()
{}
Prefix
(
InfoHash
h
)
:
size_
(
h
.
size
()
*
8
),
content_
(
h
.
begin
(),
h
.
end
())
{}
Prefix
(
InfoHash
h
)
:
size_
(
h
.
size
()
*
8
),
content_
(
h
.
begin
(),
h
.
end
())
{}
Prefix
(
const
Blob
&
d
)
:
size_
(
d
.
size
()
*
8
),
content_
(
d
)
{}
Prefix
(
const
Blob
&
d
)
:
size_
(
d
.
size
()
*
8
),
content_
(
d
)
{}
Prefix
(
const
Prefix
&
p
,
size_t
first
)
:
size_
(
first
),
content_
(
p
.
content_
.
begin
(),
p
.
content_
.
begin
()
+
first
/
8
)
{
Prefix
(
const
Prefix
&
p
,
size_t
first
)
:
auto
rem
=
first
%
8
;
size_
(
std
::
min
(
first
,
p
.
content_
.
size
()
*
8
)),
content_
(
Blob
(
p
.
content_
.
begin
(),
p
.
content_
.
begin
()
+
size_
/
8
))
{
auto
rem
=
size_
%
8
;
if
(
rem
)
if
(
rem
)
content_
.
push_back
(
p
.
content_
[
first
/
8
]
&
(
0xFF
<<
(
7
-
rem
)));
content_
.
push_back
(
p
.
content_
[
size_
/
8
]
&
(
0xFF
<<
(
7
-
rem
)));
}
}
Prefix
getPrefix
(
ssize_t
len
)
const
{
Prefix
getPrefix
(
ssize_t
len
)
const
{
...
...
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