Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xpressive
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
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
CodeLinaro
la
platform
external
boost-submodules
xpressive
Commits
0a39c2d7
Unverified
Commit
0a39c2d7
authored
4 years ago
by
Eric Niebler
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #13 from Lastique/fix_advancing_nullptr
Avoid advancing null pointers, which is UB
parents
0a314d9d
9e8a972a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/boost/xpressive/detail/utility/sequence_stack.hpp
+9
-10
9 additions, 10 deletions
include/boost/xpressive/detail/utility/sequence_stack.hpp
with
9 additions
and
10 deletions
include/boost/xpressive/detail/utility/sequence_stack.hpp
+
9
−
10
View file @
0a39c2d7
...
...
@@ -15,6 +15,7 @@
# pragma warning(disable : 4127) // conditional expression constant
#endif
#include
<cstddef>
#include
<algorithm>
#include
<functional>
...
...
@@ -210,22 +211,20 @@ public:
T
*
push_sequence
(
std
::
size_t
count
,
T
const
&
t
)
{
// This is the ptr to return
T
*
ptr
=
this
->
curr_
;
// Advance the high-water mark
this
->
curr_
+=
count
;
// Check to see if we have overflowed this buffer
if
(
std
::
less
<
void
*>
()(
this
->
end_
,
this
->
curr_
))
std
::
size_t
size_left
=
static_cast
<
std
::
size_t
>
(
this
->
end_
-
this
->
curr_
);
if
(
size_left
<
count
)
{
// oops, back this out.
this
->
curr_
=
ptr
;
// allocate a new block and return a ptr to the new memory
return
this
->
grow_
(
count
,
t
);
}
// This is the ptr to return
T
*
ptr
=
this
->
curr_
;
// Advance the high-water mark
this
->
curr_
+=
count
;
return
ptr
;
}
...
...
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