Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial call of xpath_node_set_raw::append() #20

Closed
mloy opened this issue Oct 29, 2014 · 0 comments
Closed

initial call of xpath_node_set_raw::append() #20

mloy opened this issue Oct 29, 2014 · 0 comments

Comments

@mloy
Copy link
Contributor

mloy commented Oct 29, 2014

for commit 21cff3b clang static analyzer does complain about line 7783

'memcpy(end, begin, count * sizeof(xpath_node));'

'_end: Null pointer passed as an argument to a 'nonnull' parameter'

I'm not sure, how this can happen. One possibility would be that nothing is in there yet. size_ is 0 and end is 0. Now calling append with begin = end_ does not allocate any memory and memcpy will be called with _end = 0 and count = 0. I'm not sure what memcpy is doing when nothing (count=0) is to be copied to NULL, but clang is complaining.

One simple solution would be checking at the very beginning whether begin_ == end_. In this case nothing is to be done => return.

regards,
Matthias

@zeux zeux closed this as completed in 25926c6 Nov 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant