Bug 243954 - riff file tagging chunk starts at odd position
Summary: riff file tagging chunk starts at odd position
Alias: None
Product: taglib
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 1.6.3
Platform: Compiled Sources All
: NOR normal
Target Milestone: ---
Assignee: Scott Wheeler
Depends on:
Reported: 2010-07-08 16:29 UTC by jens.dyffort
Modified: 2011-02-13 11:29 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:

aiff file with odd chunk size (4.30 KB, audio/x-aiff)
2010-07-08 16:32 UTC, jens.dyffort
patch file (1.33 KB, patch)
2010-07-08 16:36 UTC, jens.dyffort

Note You need to log in before you can comment on or make changes to this bug.
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...


 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