py573a: Some buffer size protection

This commit is contained in:
987123879113 2023-03-06 12:17:42 +09:00
parent d3b33902b6
commit 594056fd0c
1 changed files with 3 additions and 3 deletions

View File

@ -389,9 +389,9 @@ def main():
requested_frames_synced = 10
# Try to read at least a fixed number MP3 frames before determining it's valid
cur_offset = 0
while frames_synced < requested_frames_synced:
mp3_frame_length = get_mp3_frame_length(output_data[i+cur_offset:i+cur_offset+4])
cur_offset = i
while frames_synced < requested_frames_synced and cur_offset < len(output_data):
mp3_frame_length = get_mp3_frame_length(output_data[cur_offset:cur_offset+4])
if mp3_frame_length is None:
break