azure-sdk-for-c
azure-sdk-for-c copied to clipboard
_az_update_json_writer_state( ) - The result of addition must be verified before assignment.
Integer Overflow (CWE-190): • The result of addition must be verified before assignment. • File : src\azure\core\az_json_writer.c • API : _az_update_json_writer_state ( ) • Lines : 393 – 394 • Issue : Addition may lead to Integer Overflow:
- _internal.bytes_written
- total_bytes_written
• Solution :
- To perform the operation 𝐴 ≔ 𝐵 + 𝐶:
- Check if 𝐵 + 𝐶 overshoots the value INT32_MAX. • If No, the operation 𝐴 ≔ 𝐵 + 𝐶 can be computed safely. • If Yes, the Error due to Integer Overflow is reported.