Skip to content

Conversation

@amgross
Copy link
Contributor

@amgross amgross commented Jun 14, 2022

Pull request

Choose Correct

  • bug
  • feature

Describe the pull request

Check that length that going to read from heap buffer that was allocated by the auto-generated code not exceeding the buffer length
To Reproduce

Attached example code (.erpc):
min_reproduce.txt

reproduces (cpp code):
min_reproduce_server.txt
I recommend to add similar use case to tests, as currently I didn't find similar tests

to make the assert pop, return ret_size bigger than 100

Expected behavior

Stuck (at least at dev flavors), probably heap corrupted
Screenshots

Desktop (please complete the following information):

  • OS:ubuntu
  • eRPC Version: v1.9.0

Steps you didn't forgot to do

  • I checked if other PR isn't solving this issue.
  • I read Contribution details and did appropriate actions.
  • PR code is tested.
  • PR code is formatted.

Additional context

Not sure if to add enter between the assert to the write

@amgross amgross changed the title check before reading from heap the buffer boundaries check the buffer boundaries before reading from heap Jun 14, 2022
@MichalPrincNXP MichalPrincNXP requested a review from Hadatko July 1, 2022 08:20
Copy link
Member

@Hadatko Hadatko left a comment

Choose a reason for hiding this comment

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

I think * sizeof({$info.mallocSizeType}) is redudant. Binary type will be always one byte and maxSize is just number anyway.

@MichalPrincNXP MichalPrincNXP merged commit 3551af4 into EmbeddedRPC:develop Jul 1, 2022
@MichalPrincNXP
Copy link
Member

Thank you @amgross and @Hadatko

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants