sagarpant1 / mame

Other
0 stars 1 forks source link

Potential issue in 3rdparty/portaudio/src/os/win/pa_win_util.c: Unchecked return from initialization function #3

Open monocle-ai opened 4 years ago

monocle-ai commented 4 years ago

What is a Conditionally Uninitialized Variable? The return value of a function that is potentially used to initialize a local variable is not checked. Therefore, reading the local variable may result in undefined behavior.

1 instance of this defect were found in the following locations:


Instance 1 File : 3rdparty/portaudio/src/os/win/pa_win_util.c Enclosing Function : PaUtil_GetTime Function : QueryPerformanceCounter@4 https://github.com/sagarpant1/mame/blob/fe529afa8e0669d323dec9e3a575efc399009e5c/3rdparty/portaudio/src/os/win/pa_win_util.c#L145 Issue in: time

Code extract:


            For now we just use QueryPerformanceCounter(). It's good, most of the time.
        */
        QueryPerformanceCounter( &time ); <------ HERE
        return time.QuadPart * secondsPerTick_;
    }

How can I fix it? Correct reference usage found in 3rdparty/asmjit/src/asmjit/core/osutils.cpp at line 57. https://github.com/sagarpant1/mame/blob/fe529afa8e0669d323dec9e3a575efc399009e5c/3rdparty/asmjit/src/asmjit/core/osutils.cpp#L57 Code extract:

  uint32_t status = _hiResStatus.load();
  LARGE_INTEGER now, qpf;

  if (status != kHiResNotAvailable && ::QueryPerformanceCounter(&now)) { <------ HERE
    double freq = _hiResFreq;
    if (status == kHiResUnknown) {
siva-msft commented 4 years ago

QueryPerformanceCounter need to ask Matt. Hold off.