Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
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
protobuf
Commits
e9abbd23
Commit
e9abbd23
authored
Apr 13, 2015
by
Chris Fallin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue #283: crash in JSON handler cleanup.
Includes repro test case from @wfarr.
parent
be89e626
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
defs.c
ruby/ext/google/protobuf_c/defs.c
+1
-1
basic.rb
ruby/tests/basic.rb
+24
-0
No files found.
ruby/ext/google/protobuf_c/defs.c
View file @
e9abbd23
...
...
@@ -250,7 +250,7 @@ void Descriptor_free(void* _self) {
&
self
->
pb_serialize_handlers
);
}
if
(
self
->
json_serialize_handlers
)
{
upb_handlers_unref
(
self
->
pb
_serialize_handlers
,
upb_handlers_unref
(
self
->
json
_serialize_handlers
,
&
self
->
json_serialize_handlers
);
}
xfree
(
self
);
...
...
ruby/tests/basic.rb
View file @
e9abbd23
...
...
@@ -8,6 +8,19 @@ require 'test/unit'
module
BasicTest
pool
=
Google
::
Protobuf
::
DescriptorPool
.
new
pool
.
build
do
add_message
"Foo"
do
optional
:bar
,
:message
,
1
,
"Bar"
repeated
:baz
,
:message
,
2
,
"Baz"
end
add_message
"Bar"
do
optional
:msg
,
:string
,
1
end
add_message
"Baz"
do
optional
:msg
,
:string
,
1
end
add_message
"TestMessage"
do
optional
:optional_int32
,
:int32
,
1
optional
:optional_int64
,
:int64
,
2
...
...
@@ -84,6 +97,9 @@ module BasicTest
end
end
Foo
=
pool
.
lookup
(
"Foo"
).
msgclass
Bar
=
pool
.
lookup
(
"Bar"
).
msgclass
Baz
=
pool
.
lookup
(
"Baz"
).
msgclass
TestMessage
=
pool
.
lookup
(
"TestMessage"
).
msgclass
TestMessage2
=
pool
.
lookup
(
"TestMessage2"
).
msgclass
Recursive1
=
pool
.
lookup
(
"Recursive1"
).
msgclass
...
...
@@ -992,6 +1008,14 @@ module BasicTest
json_text
=
TestMessage
.
encode_json
(
m
)
m2
=
TestMessage
.
decode_json
(
json_text
)
assert
m
==
m2
# Crash case from GitHub issue 283.
bar
=
Bar
.
new
(
msg:
"bar"
)
baz1
=
Baz
.
new
(
msg:
"baz"
)
baz2
=
Baz
.
new
(
msg:
"quux"
)
Foo
.
encode_json
(
Foo
.
new
)
Foo
.
encode_json
(
Foo
.
new
(
bar:
bar
))
Foo
.
encode_json
(
Foo
.
new
(
bar:
bar
,
baz:
[
baz1
,
baz2
]))
end
def
test_json_maps
...
...
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