Valgrind warning on save: Syscall param read(buf) is non-contiguous

Robin Stocker robin at nibor.org
Sat Sep 17 10:07:32 UTC 2011


Hi there,

Is the following Valgrind warning something to be worried about or is it
expected due to the optimizations in insert?


==3383== Syscall param read(buf) is non-contiguous
==3383==    at 0x5934340: __read_nocancel (syscall-template.S:82)
==3383==    by 0x58D0E92: _IO_file_xsgetn (fileops.c:1465)
==3383==    by 0x58C51D2: fread (iofread.c:44)
==3383==    by 0x4E8021E: TagLib::File::insert(TagLib::ByteVector const&, unsigned long, unsigned long) (in /usr/lib/libtag.so.1.6.3)
==3383==    by 0x4E56AAB: TagLib::MPEG::File::save(int, bool) (in /usr/lib/libtag.so.1.6.3)
==3383==    by 0x401160: main (in trigger)
==3383==  First byte (0x5ed6d80) is 0 bytes inside a 128-byte block alloc'd
==3383==    at 0x4C28312: operator new(unsigned long) (vg_replace_malloc.c:261)
==3383==    by 0x4E7DB6A: TagLib::ByteVector::detach() (in /usr/lib/libtag.so.1.6.3)
==3383==    by 0x4E7DC58: TagLib::ByteVector::data() (in /usr/lib/libtag.so.1.6.3)
==3383==    by 0x4E8020B: TagLib::File::insert(TagLib::ByteVector const&, unsigned long, unsigned long) (in /usr/lib/libtag.so.1.6.3)
==3383==    by 0x4E56AAB: TagLib::MPEG::File::save(int, bool) (in /usr/lib/libtag.so.1.6.3)
==3383==    by 0x401160: main (in trigger)
==3383==  Last byte is not inside a known block


The output is from the exp-ptrcheck tool, but memcheck also reports it.
It also happens with 1.7. The test code is simple:


int main(int argc, char ** argv) {
  TagLib::MPEG::File f("test/data/sample.mp3", false);

  ImageFile picFile("test/data/globe_east_540.jpg");
  TagLib::ByteVector data = picFile.data();

  TagLib::ID3v2::AttachedPictureFrame *apic = new TagLib::ID3v2::AttachedPictureFrame();
  apic->setMimeType("image/jpeg");
  apic->setDescription("desc");
  apic->setTextEncoding(TagLib::String::UTF8);
  apic->setPicture(data);

  f.ID3v2Tag()->addFrame(apic);
  f.save();

  return 0;
}


ImageFile is the same as in the taglib-set-picture.cpp file (subclass of 
TagLib::File).

Regards,
  Robin Stocker


More information about the taglib-devel mailing list