mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-27 03:50:29 +00:00
src/sd2.c: Fix parsing of some SD2 files
Exit early when Photoshop file is detected. Closes: https://github.com/erikd/libsndfile/issues/526
This commit is contained in:
parent
de7d60fe6e
commit
422b29c06d
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright (C) 2001-2017 Erik de Castro Lopo <erikd@mega-nerd.com>
|
** Copyright (C) 2001-2020 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||||
** Copyright (C) 2004 Paavo Jumppanen
|
** Copyright (C) 2004 Paavo Jumppanen
|
||||||
**
|
**
|
||||||
** This program is free software; you can redistribute it and/or modify
|
** This program is free software; you can redistribute it and/or modify
|
||||||
@ -516,6 +516,7 @@ parse_str_rsrc (SF_PRIVATE *psf, SD2_RSRC * rsrc)
|
|||||||
str_offset = rsrc->string_offset ;
|
str_offset = rsrc->string_offset ;
|
||||||
psf_log_printf (psf, " Offset RsrcId dlen slen Value\n") ;
|
psf_log_printf (psf, " Offset RsrcId dlen slen Value\n") ;
|
||||||
|
|
||||||
|
|
||||||
for (k = 0 ; data_offset + data_len < rsrc->rsrc_len ; k++)
|
for (k = 0 ; data_offset + data_len < rsrc->rsrc_len ; k++)
|
||||||
{ int slen ;
|
{ int slen ;
|
||||||
|
|
||||||
@ -542,6 +543,11 @@ parse_str_rsrc (SF_PRIVATE *psf, SD2_RSRC * rsrc)
|
|||||||
|
|
||||||
psf_log_printf (psf, " 0x%04x %4d %4d %3d '%s'\n", data_offset, rsrc_id, data_len, slen, value) ;
|
psf_log_printf (psf, " 0x%04x %4d %4d %3d '%s'\n", data_offset, rsrc_id, data_len, slen, value) ;
|
||||||
|
|
||||||
|
if (strstr (value, "Photoshop"))
|
||||||
|
{ psf_log_printf (psf, "Exiting parser on Photoshop data.\n", data_offset) ;
|
||||||
|
break ;
|
||||||
|
} ;
|
||||||
|
|
||||||
if (rsrc_id == 1000 && rsrc->sample_size == 0)
|
if (rsrc_id == 1000 && rsrc->sample_size == 0)
|
||||||
rsrc->sample_size = strtol (value, NULL, 10) ;
|
rsrc->sample_size = strtol (value, NULL, 10) ;
|
||||||
else if (rsrc_id == 1001 && rsrc->sample_rate == 0)
|
else if (rsrc_id == 1001 && rsrc->sample_rate == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user