• 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 11:42:24 -0800

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.
  • Follow-Ups:
    • AUInlineEffectBase Process methods
      • From: Marc Poirier <email@hidden>
    • Re: crashes in AUBase::RestoreState
      • From: Bill Stewart <email@hidden>
    • Re: crashes in AUBase::RestoreState
      • From: Marc Poirier <email@hidden>
  • Prev by Date: Re: VST Wrapper
  • Next by Date: Re: crashes in AUBase::RestoreState
  • Previous by thread: crashes in AUBase::RestoreState
  • Next by thread: Re: crashes in AUBase::RestoreState
  • Index(es):
    • Date
    • Thread