Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Don't allow for unlimited nesting in FBUnserialize or fb_compact_unserialize
- Loading branch information
Showing
9 changed files
with
286 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?hh | ||
| // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
|
|
||
| <<__EntryPoint>> | ||
| function main() { | ||
| $ret = null; | ||
| var_dump(fb_unserialize("\x14\x02\x01\x14\x02\x01\x02\x01\x01\x01", inout $ret)); | ||
| var_dump($ret); | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| bool(false) | ||
| bool(false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| <?hh | ||
| // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
|
|
||
| function make_fb_serialize_struct($size) { | ||
| return str_repeat("\x0a\x02\x01", $size) . "\x02\x01" . str_repeat("\x01", $size); | ||
| } | ||
|
|
||
| function make_fb_serialize_vector($size) { | ||
| return str_repeat("\x12", $size) . str_repeat("\x01", $size); | ||
| } | ||
|
|
||
| function make_fb_serialize_list($size) { | ||
| return str_repeat("\x13\x02\x01", $size) . "\x02\x01" . str_repeat("\x01", $size); | ||
| } | ||
|
|
||
| function make_fb_cs_list_map($size) { | ||
| return str_repeat("\xfa\xfd", $size) . str_repeat("\xfc", $size); | ||
| } | ||
|
|
||
| function make_fb_cs_map($size) { | ||
| return str_repeat("\xfb\x01", $size) . "\x01" . str_repeat("\xfc", $size); | ||
| } | ||
|
|
||
| function make_fb_cs_vector($size) { | ||
| return str_repeat("\xfe", $size) . str_repeat("\xfc", $size); | ||
| } | ||
|
|
||
| function test($serialized) { | ||
| $ret = null; | ||
| var_dump( | ||
| fb_unserialize( | ||
| $serialized, | ||
| inout $ret, | ||
| FB_SERIALIZE_HACK_ARRAYS | ||
| ) | ||
| ); | ||
| var_dump($ret); | ||
| } | ||
|
|
||
| function tests($size) { | ||
| test(make_fb_serialize_struct($size)); | ||
| test(make_fb_serialize_vector($size)); | ||
| test(make_fb_serialize_list($size)); | ||
| test(make_fb_cs_list_map($size)); | ||
| test(make_fb_cs_map($size)); | ||
| test(make_fb_cs_vector($size)); | ||
| } | ||
|
|
||
| <<__EntryPoint>> | ||
| function main() { | ||
| tests(10); | ||
| tests(1026); | ||
| } |
Oops, something went wrong.