digideskio / protobuf-c

Automatically exported from code.google.com/p/protobuf-c
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Null pointer access when trying to unpack a message without a required field. #81

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Pack a message without a required field (using optional instead of required 
for instance)
2. Call my_message__unpack using this buffer

What is the expected output? What do you see instead?
- my_message__unpack should return NULL but the process is terminated due to a 
SEGV signal.

What version of the product are you using? On what operating system?
- protobuf-c 0.15 on Linux

Please provide any additional information below.
- On protobuf-c:2401 the variable arr is NULL if a required field is not found 
and any access in the following if statements will fail doing arr[i]. There 
should be a check at the beginning "if (arr != NULL)" surrounding the if 
statements.

Original issue reported on code.google.com by lorenzo....@gmail.com on 11 Apr 2012 at 5:53