Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
561fe0f5
Commit
561fe0f5
authored
Apr 26, 2017
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix fuzz test with -fno-exceptions.
parent
3e388975
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
19 deletions
+34
-19
layout.c++
c++/src/capnp/layout.c++
+34
-19
No files found.
c++/src/capnp/layout.c++
View file @
561fe0f5
...
...
@@ -537,8 +537,9 @@ struct WireHelpers {
return
result
;
}
static
KJ_ALWAYS_INLINE
(
const
word
*
followFars
(
const
WirePointer
*&
ref
,
const
word
*
refTarget
,
SegmentReader
*&
segment
))
{
static
KJ_ALWAYS_INLINE
(
kj
::
Maybe
<
const
word
&>
followFars
(
const
WirePointer
*&
ref
,
const
word
*
refTarget
,
SegmentReader
*&
segment
))
KJ_WARN_UNUSED_RESULT
{
// Like the other followFars() but operates on readers.
// If the segment is null, this is an unchecked message, so there are no FAR pointers.
...
...
@@ -582,6 +583,7 @@ struct WireHelpers {
segment
=
newSegment
;
return
pad
->
farTarget
(
segment
);
}
else
{
KJ_DASSERT
(
refTarget
!=
nullptr
);
return
refTarget
;
}
}
...
...
@@ -754,7 +756,12 @@ struct WireHelpers {
}
--
nestingLimit
;
const
word
*
ptr
=
followFars
(
ref
,
ref
->
target
(
segment
),
segment
);
const
word
*
ptr
;
KJ_IF_MAYBE
(
p
,
followFars
(
ref
,
ref
->
target
(
segment
),
segment
))
{
ptr
=
p
;
}
else
{
return
result
;
}
switch
(
ref
->
kind
())
{
case
WirePointer
:
:
STRUCT
:
{
...
...
@@ -1918,9 +1925,10 @@ struct WireHelpers {
return
{
dstSegment
,
nullptr
};
}
const
word
*
ptr
=
WireHelpers
::
followFars
(
src
,
srcTarget
,
srcSegment
);
if
(
KJ_UNLIKELY
(
ptr
==
nullptr
))
{
// Already reported the error.
const
word
*
ptr
;
KJ_IF_MAYBE
(
p
,
WireHelpers
::
followFars
(
src
,
srcTarget
,
srcSegment
))
{
ptr
=
p
;
}
else
{
goto
useDefault
;
}
...
...
@@ -2135,9 +2143,10 @@ struct WireHelpers {
goto
useDefault
;
}
const
word
*
ptr
=
followFars
(
ref
,
refTarget
,
segment
);
if
(
KJ_UNLIKELY
(
ptr
==
nullptr
))
{
// Already reported the error.
const
word
*
ptr
;
KJ_IF_MAYBE
(
p
,
followFars
(
ref
,
refTarget
,
segment
))
{
ptr
=
p
;
}
else
{
goto
useDefault
;
}
...
...
@@ -2220,9 +2229,10 @@ struct WireHelpers {
goto
useDefault
;
}
const
word
*
ptr
=
followFars
(
ref
,
refTarget
,
segment
);
if
(
KJ_UNLIKELY
(
ptr
==
nullptr
))
{
// Already reported error.
const
word
*
ptr
;
KJ_IF_MAYBE
(
p
,
followFars
(
ref
,
refTarget
,
segment
))
{
ptr
=
p
;
}
else
{
goto
useDefault
;
}
...
...
@@ -2390,10 +2400,10 @@ struct WireHelpers {
return
Text
::
Reader
(
reinterpret_cast
<
const
char
*>
(
defaultValue
),
unbound
(
defaultSize
/
BYTES
));
}
else
{
const
word
*
ptr
=
followFars
(
ref
,
refTarget
,
segment
)
;
if
(
KJ_UNLIKELY
(
ptr
==
nullptr
))
{
// Already reported error.
const
word
*
ptr
;
KJ_IF_MAYBE
(
p
,
followFars
(
ref
,
refTarget
,
segment
))
{
ptr
=
p
;
}
else
{
goto
useDefault
;
}
...
...
@@ -2443,7 +2453,12 @@ struct WireHelpers {
return
Data
::
Reader
(
reinterpret_cast
<
const
byte
*>
(
defaultValue
),
unbound
(
defaultSize
/
BYTES
));
}
else
{
const
word
*
ptr
=
followFars
(
ref
,
refTarget
,
segment
);
const
word
*
ptr
;
KJ_IF_MAYBE
(
p
,
followFars
(
ref
,
refTarget
,
segment
))
{
ptr
=
p
;
}
else
{
goto
useDefault
;
}
if
(
KJ_UNLIKELY
(
ptr
==
nullptr
))
{
// Already reported error.
...
...
@@ -2694,10 +2709,10 @@ PointerType PointerReader::getPointerType() const {
if
(
pointer
==
nullptr
||
pointer
->
isNull
())
{
return
PointerType
::
NULL_
;
}
else
{
word
*
refTarget
=
nullptr
;
const
WirePointer
*
ptr
=
pointer
;
const
word
*
refTarget
=
ptr
->
target
(
segment
);
SegmentReader
*
sgmt
=
segment
;
WireHelpers
::
followFars
(
ptr
,
refTarget
,
sgmt
)
;
if
(
WireHelpers
::
followFars
(
ptr
,
refTarget
,
sgmt
)
==
nullptr
)
return
PointerType
::
NULL_
;
switch
(
ptr
->
kind
())
{
case
WirePointer
:
:
FAR
:
KJ_FAIL_ASSERT
(
"far pointer not followed?"
)
{
return
PointerType
::
NULL_
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment