AudioFileStream returning bogus magic cookie data
AudioFileStream returning bogus magic cookie data
- Subject: AudioFileStream returning bogus magic cookie data
- From: Jens Alfke <email@hidden>
- Date: Mon, 16 Jun 2008 17:48:49 -0700
I've got a regression in my app, which I think coincides with
upgrading to QuickTime 7.5. I hadn't used this functionality in a few
weeks, but I hadn't changed anything in it that could cause this,
either; and I know there were changes relating to the ADTS codec in QT
7.5 because the release notes call out a fix of an ADTS security bug
that I found.
The problem is this: When I get the value of
kAudioFileStreamProperty_MagicCookieData, the data returned is bogus:
it consists entirely of 0xAA bytes. This happens only if the
MallocScribble environment variable is set; this variable not-
coincidentally fills newly-malloc'ed blocks with 0xAA. The implication
is that something down in CA or QT is neglecting to initialize memory.
Here's what my code looks like:
- (NSData *)magicCookie
{
UInt32 size;
OSStatus err = AudioFileStreamGetPropertyInfo (_stream,
kAudioFileStreamProperty_MagicCookieData, &size, NULL);
if( err )
return nil;
NSMutableData *cookie = [NSMutableData dataWithCapacity: size];
cookie.length = size;
err =
AudioFileStreamGetProperty
(_stream,kAudioFileStreamProperty_MagicCookieData, &size,
cookie.mutableBytes);
if( err )
return nil;
return cookie;
}
Before the AudioFileStreamGetProperty call, the NSData object is full
of 0x00 bytes as expected. Afterwards, they're all 0xAA. But if
MallocScribble is not set, the correct magic cookie is retrieved, at
least I assume so, because in that case the audio plays successfully.
Any ideas? It's hard for me to imagine how this could happen — I'm
familiar with seeing 0x55 values indicating that memory was copied out
of a malloc block after it was freed, but it's hard to visualize how
an uninitialized block could magically contain the right data.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden