<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
So given that there are apparently people on this mailing list, has anyone had a look at this? I've not heard anything back at all.<br><br>Thanks.<br><br><br><hr id="stopSpelling">From: sayte75@hotmail.com<br>To: flac-dev@xiph.org<br>Date: Wed, 28 Jan 2009 19:50:10 +0000<br>Subject: [Flac-dev] Missing dereference in Stream::set_metadata()?<br><br>
<style>
.ExternalClass .EC_hmmessage P
{padding:0px;}
.ExternalClass body.EC_hmmessage
{font-size:10pt;font-family:Verdana;}
</style>
Hello,<br><br>I seem to have hit a bug with adding meta data to a stream via the C++ interface. I am using FLAC 1.2.1. I've had a look through the email list archive and can't spot anything similar.<br><br>The Stream::set_metadata(Prototype) function takes a double pointer which implies that it is expecting an array of pointers to Prototype objects. For example:<br><font style="" face="Courier New"> FLAC::Metadata::Prototype *table[2];</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> FLAC::Metadata::VorbisComment comment;</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> FLAC::Metadata::SeekTable seek;</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> table[0] = &seek;</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> table[1] = &comment;</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> bool bSuccess = encoder->set_metadata( table, 2 );</font><font style="" face="Courier New"><br></font><br>The assumption from the (very brief) API doxygen is that it will internally convert from FLAC::Metadata::Prototype pointers to FLAC__StreamMetadata pointers. Looking at the code, it does do the conversion but as a straight cast which is therefore nothing more than an assignment. As the two objects are not equivalent, this is a broken conversion. It results in an array of FLAC_SM pointers that return gibberish when used and produces seg faults, infinite memory consumption and other nasty effects!<br><br>The code needs to derefence the FLAC::M::P pointer before doing the cast in order to make the compiler call the conversion operator on the object. That is, it should read:<br> m[i] = const_cast< ::FLAC__StreamMetadata*>((const ::FLAC__StreamMetadata*)*metadata[i]);<br><br>If I make the above change then everything works quite happily and I can produce FLAC files that are exact binary matches with those produced by the flac command line tool.<br><br>Is this a genuine bug or am I missing something?<br><br>Thanks.<br><br><br><hr>Share your photos with Windows Live Photos – Free <a href="http://clk.atdmt.com/UKM/go/132630768/direct/01/">Find out more!</a><br /><hr />Windows Live Hotmail just got better. <a href='http://www.microsoft.com/uk/windows/windowslive/products/hotmail.aspx' target='_new'>Find out more!</a></body>
</html>