mirror of
https://github.com/openai/codex.git
synced 2026-10-20 08:19:50 +00:00
Reject empty audio payloads in data URLs (#44070)
Return `AudioPreparationError::InvalidDataUrl` with the reason `audio payload is empty` when the decoded base64 payload is empty. GitOrigin-RevId: e886dab5f49ebb1a363dbc1c292813b2b52698d4
This commit is contained in:
@@ -246,6 +246,11 @@ fn prepare_audio(audio_url: &mut String) -> Result<(), AudioPreparationError> {
|
||||
.map_err(|_| AudioPreparationError::InvalidDataUrl {
|
||||
reason: "invalid base64 payload",
|
||||
})?;
|
||||
if bytes.is_empty() {
|
||||
return Err(AudioPreparationError::InvalidDataUrl {
|
||||
reason: "audio payload is empty",
|
||||
});
|
||||
}
|
||||
if bytes.len() > MAX_PROMPT_AUDIO_INPUT_BYTES {
|
||||
return Err(AudioPreparationError::AudioTooLarge { size: bytes.len() });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user