Skip to content

Commit 3deee1b

Browse files
committed
Metadata support for Buffersize gt 1K
1 parent 07b5582 commit 3deee1b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/AudioMetaData/MetaDataID3.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ class MetaDataID3Base {
6969

7070
/// find the tag position in the string - if not found we return -1;
7171
int findTag(const char* tag, const char*str, size_t len){
72-
if (len>1600 || str==nullptr || len<=0) return -1;
72+
if (str==nullptr || len<=0) return -1;
73+
// The tags are usally in the first 500 bytes - we limit the search
74+
if (len>1600){
75+
len = 1600;
76+
}
7377
size_t tag_len = strlen(tag);
7478
for (size_t j=0;j<=len-tag_len-1;j++){
7579
if (memcmp(str+j,tag, tag_len)==0){
@@ -422,8 +426,10 @@ class MetaDataID3V2 : public MetaDataID3Base {
422426
int l = min(calcSize(frame_header.size)-1, (uint32_t) 256);
423427
memset(result,0,256);
424428
strncpy((char*)result, (char*) data+tag_pos+ID3FrameSize, l);
425-
if (isAscii(l))
429+
int checkLen = min(l, 10);
430+
if (isAscii(checkLen)){
426431
processNotify();
432+
}
427433
} else {
428434
partial_tag = tag;
429435
}

0 commit comments

Comments
 (0)