mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-14 06:32:33 +00:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
dc501c1b62
1 changed files with 4 additions and 2 deletions
|
@ -10,6 +10,8 @@ use std::io::{Cursor, Read, Seek, SeekFrom, Write};
|
||||||
|
|
||||||
use byteorder::{LittleEndian, WriteBytesExt};
|
use byteorder::{LittleEndian, WriteBytesExt};
|
||||||
|
|
||||||
|
const MAX_BLOCK_SIZE: u32 = 16_777_215;
|
||||||
|
|
||||||
pub(in crate) fn write_to(data: &mut File, tag: &mut VorbisCommentsRef) -> Result<()> {
|
pub(in crate) fn write_to(data: &mut File, tag: &mut VorbisCommentsRef) -> Result<()> {
|
||||||
let stream_info = verify_flac(data)?;
|
let stream_info = verify_flac(data)?;
|
||||||
let stream_info_end = stream_info.end as usize;
|
let stream_info_end = stream_info.end as usize;
|
||||||
|
@ -127,7 +129,7 @@ fn create_comment_block(
|
||||||
|
|
||||||
let len = (writer.get_ref().len() - 1) as u32;
|
let len = (writer.get_ref().len() - 1) as u32;
|
||||||
|
|
||||||
if len > 65535 {
|
if len > MAX_BLOCK_SIZE {
|
||||||
return Err(LoftyError::TooMuchData);
|
return Err(LoftyError::TooMuchData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +160,7 @@ fn create_picture_blocks(
|
||||||
let pic_bytes = pic.as_flac_bytes(info, false);
|
let pic_bytes = pic.as_flac_bytes(info, false);
|
||||||
let pic_len = pic_bytes.len() as u32;
|
let pic_len = pic_bytes.len() as u32;
|
||||||
|
|
||||||
if pic_len > 65535 {
|
if pic_len > MAX_BLOCK_SIZE {
|
||||||
return Err(LoftyError::TooMuchData);
|
return Err(LoftyError::TooMuchData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue