• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: crashes in AUBase::RestoreState
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: crashes in AUBase::RestoreState


  • Subject: Re: crashes in AUBase::RestoreState
  • From: Bill Stewart <email@hidden>
  • Date: Fri, 7 Feb 2003 12:31:33 -0800

In going over this there's one other change that I think is useful

The RestoreState call will normally fail if there is no "data" entry key in the list.

The "data" entry key is generated by the SaveState call and contains the values of each of the AU parameters...

However, it occurs to me that if you are taking VST data into an AU for the first time, it won't have a data value (or really know how to generate one)

So - I think modifying this test is a cleaner alternative:

if (data)
{
do the current param value setting
}
else
{
if (vstdata-key == false)
return invalidPropertyValueErr;
// continues if it does have the vstdata key
}

Bill

On Friday, February 7, 2003, at 11:42 AM, Bill Stewart wrote:
A reasonable fix, and I agree that crashing is not the best way to handle an illegal data format:)

Still - this is an illegal format - some keys in an AU Preset are required - so the errors will be caught and returned.. I'll modify our code to "do the right thing" here:)

Thanks Marc

Bill

On Friday, February 7, 2003, at 08:56 AM, Marc Poirier wrote:

Hi. I was just playing with an AU host app that is supporting importing
VST plugin settings to AU counterparts with the "vstdata" dictionary key,
etc. I found that the process was crashing in AUBase::RestoreState
because the host was not creating all of the standard AU Dictionary keys
and AUBase::RestoreState does not fetch dictionary values in a safe
fashion: a fatal combination. For example, I'd like to direct the class'
attention to the first part of AUBase::RestoreState (with added commentary
from me):

CFNumberRef cfnum = reinterpret_cast<CFNumberRef>(CFDictionaryGetValue(dict, kVersionString));
/* if kVersionString is missing, cfnum will receive NULL */
SInt32 value;
CFNumberGetValue (cfnum, kCFNumberSInt32Type, &value);
/* if cfnum was NULL, then we just crashed the app */
if (value != kCurrentSavedStateVersion) return kAudioUnitErr_InvalidPropertyValue;

This is the way that things are done for pretty much every key in
AUBase::RestoreState. I suggest that the code be changed to something
more like this:

CFNumberRef cfnum = reinterpret_cast<CFNumberRef>(CFDictionaryGetValue(dict, kVersionString));
if (cfnum == NULL)
return kAudioUnitErr_InvalidPropertyValue;
SInt32 value;
CFNumberGetValue (cfnum, kCFNumberSInt32Type, &value);
if (value != kCurrentSavedStateVersion) return kAudioUnitErr_InvalidPropertyValue;


or perhaps better still:

CFNumberRef cfnum;
if ( !CFDictionaryGetValueIfPresent(dict, kVersionString, (const void**)&cfnum) )
return kAudioUnitErr_InvalidPropertyValue;
SInt32 value;
CFNumberGetValue (cfnum, kCFNumberSInt32Type, &value);
if (value != kCurrentSavedStateVersion) return kAudioUnitErr_InvalidPropertyValue;


Marc
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.


-- mailto:email@hidden
tel: +1 408 974 4056

_______________________________________________________________________ ___
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
_______________________________________________________________________ ___
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.


--
mailto:email@hidden
tel: +1 408 974 4056

________________________________________________________________________ __
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________ __
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: crashes in AUBase::RestoreState (From: Bill Stewart <email@hidden>)

  • Prev by Date: VOX recording
  • Next by Date: zero-crossing division of an AIFF file
  • Previous by thread: Re: crashes in AUBase::RestoreState
  • Next by thread: AUInlineEffectBase Process methods
  • Index(es):
    • Date
    • Thread