Ticket #61 (new defect)

Opened 11 months ago

Last modified 6 months ago

tests don't check for NULL return value of Pa_GetDeviceInfo()

Reported by: rossb Owned by: somebody
Priority: major Milestone: V19-RC1
Component: test Version: 2.0
Keywords: Cc:

Description

Pa_GetDeviceInfo() returns NULL on error (usually an invalid device index is passed)

Many tests have code similar to: Pa_GetDeviceInfo( Pa_GetDefaultOutputDevice() )->defaultLowOutputLatency;

Which will segfault if there is no default device (ie when Pa_GetDefaultOutputDevice() returns -1).

All tests and code should be corrected to check for a valid pointer return from Pa_GetDeviceInfo(), and also for a positive result from GetDefault?*Device().

Change History

Changed 6 months ago by rossb

Magnus Jonsson used the following technique to fix this in paqa_errs.c in r1368

+ info = Pa_GetDeviceInfo(Pa_GetDefaultInputDevice()); + ipp.suggestedLatency = info ? info->defaultLowInputLatency : 0.100; + info = Pa_GetDeviceInfo(Pa_GetDefaultOutputDevice()); + opp.suggestedLatency = info ? info->defaultLowOutputLatency : 0.100;

Note: See TracTickets for help on using tickets.