Bug 243954

Summary: riff file tagging chunk starts at odd position
Product: [Frameworks and Libraries] taglib Reporter: jens.dyffort
Component: generalAssignee: Scott Wheeler <wheeler>
Status: RESOLVED FIXED    
Severity: normal CC: lalinsky, shafff, tobias
Priority: NOR    
Version: 1.6.3   
Target Milestone: ---   
Platform: Compiled Sources   
OS: All   
Latest Commit: Version Fixed In:
Attachments: aiff file with odd chunk size
patch file

Description jens.dyffort 2010-07-08 16:29:21 UTC
+++ This bug was initially created as a clone of Bug #175781 +++

If the last chunk has an odd size, id3 chunk will be written at odd position.

- take the attached sample
- tag it 
- look where the chunk starts

That will corrupt the file.

patch attached (on base of svn://anonsvn.kde.org/home/kde/tags/taglib/1.6.3)
Comment 1 jens.dyffort 2010-07-08 16:32:52 UTC
Created attachment 48691 [details]
aiff file with odd chunk size
Comment 2 jens.dyffort 2010-07-08 16:36:53 UTC
Created attachment 48692 [details]
patch file

based on  svn://anonsvn.kde.org/home/kde/tags/taglib/1.6.3
Comment 3 tobias 2010-10-15 18:06:56 UTC
Jens, thanks so much for the patch, you are definitely right, it is a bug and should be fixed in taglib!
Comment 4 Nick Shaforostoff 2011-02-01 20:07:40 UTC
is there a reason this patch is not applied yet in trunk?
Comment 5 Lukáš Lalinský 2011-02-13 11:29:02 UTC
SVN commit 1220223 by lalinsky:

Fix writing of new RIFF chunks at even positions

If the last chunk had an odd size, the new chunk would have been written at
odd position, which is incorrect.

This is based on the patch by Jens Dyffort, but I ended up changing the
implementation to correctly handle subsequential updates to the file.

The whole RIFF code really needs to be rewritten in a different way...

BUG:243954


 M  +42 -13    taglib/riff/rifffile.cpp  
 M  +12 -1     taglib/riff/rifffile.h  
 AM            tests/data/noise.aif  
 AM            tests/data/noise_odd.aif  
 M  +116 -0    tests/test_riff.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1220223