mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-16 08:42:50 +00:00
Merge pull request #9066 from paul-elliott-arm/fix_ubsan_mp_aead_gcm_3.6
[Backport 3.6] Add early exit if zero length AEAD additional data passed in.
This commit is contained in:
commit
3dbb502098
3
ChangeLog.d/fix_ubsan_mp_aead_gcm.txt
Normal file
3
ChangeLog.d/fix_ubsan_mp_aead_gcm.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Bugfix
|
||||||
|
* Fix undefined behaviour (incrementing a NULL pointer by zero length) when
|
||||||
|
passing in zero length additional data to multipart AEAD.
|
@ -5194,6 +5194,12 @@ psa_status_t psa_aead_update_ad(psa_aead_operation_t *operation,
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* No input to add (zero length), nothing to do. */
|
||||||
|
if (input_length == 0) {
|
||||||
|
status = PSA_SUCCESS;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
if (operation->lengths_set) {
|
if (operation->lengths_set) {
|
||||||
if (operation->ad_remaining < input_length) {
|
if (operation->ad_remaining < input_length) {
|
||||||
status = PSA_ERROR_INVALID_ARGUMENT;
|
status = PSA_ERROR_INVALID_ARGUMENT;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user