Skip to content

fail stream decoding whenever the context stack size reaches a threshold - #138

Merged
PJK merged 6 commits into
PJK:masterfrom
James-ZHANG:limit-stack-size
Apr 8, 2020
Merged

PJK merged 6 commits into
PJK:masterfrom
James-ZHANG:limit-stack-size

Conversation

@James-ZHANG

Copy link
Copy Markdown
Contributor

Right now this threshold is set to 255. Maybe it's better to make it a config value in configuration.h.in?

@James-ZHANG

Copy link
Copy Markdown
Contributor Author

Hi, Pavel,
Could you take a look at this?

@PJK PJK left a comment •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, I have three requests:
1/ As you say, could you please move this to be a build-time constant? There is no autotools header files, https://github.com/PJK/libcbor/blob/master/CMakeLists.txt#L22 would be the right place
2/ Please add tests exercising the new behavior
3/ 255 seems sort of low. Are you aware of any datasets or resources that would could provide a good empirical estimate of what is common "in the wild"? If not, I would stay on the safe side and bump this to something generous, say 2k.

Thanks for driving this forward!

Comment thread src/cbor/internal/builder_callbacks.c Resolved
@James-ZHANG

Copy link
Copy Markdown
Contributor Author

Tests added and did some refactoring of memory allocation macros.

@PJK
PJK merged commit 2f75f23 into PJK:master Apr 8, 2020
@PJK

PJK commented Apr 8, 2020

Copy link
Copy Markdown
Owner

Thanks!

PJK added a commit that referenced this pull request Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

⌂ 换网址