diff --git a/modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp index ceeb3cfc19..bf5142d7da 100644 --- a/modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_AiffAudioFormat.cpp @@ -225,7 +225,10 @@ namespace AiffFileHelpers out.writeShortBigEndian ((short) values.getValue (prefix + "Identifier", "0").getIntValue()); const String comment (values.getValue (prefix + "Text", String::empty)); - out.write (comment.toUTF8(), jmin (comment.getNumBytesAsUTF8(), 65534)); + + const int commentLength = jmin (comment.getNumBytesAsUTF8(), 65534); + out.writeShortBigEndian ((short) commentLength + 1); + out.write (comment.toUTF8(), commentLength); out.writeByte (0); if ((out.getDataSize() & 1) != 0)