-
-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assess and fix Coverity issues prior to 0.81 release #2996
Comments
Some of these are from third party libraries. I saw at least SDL Sound and stb_vorbis in there. Do we really want to be diverging from upstream for some minor warning fixes? Or should be ignoring these warnings from the |
Yup, PR or report as much as possible upstream (just like you did w/ libmt32emu). For STB Vorbis specifically, we've:
Suggest a similar approach here; and no problem carrying this issue in Coverity as long as needed till upstream fixes it. We've had a similar approach for other ported-in sources too (like Enet, dr_flac, dr_wav, dr_mp3, PD curses, slirp, .. and maybe others). |
For It's highly cut down just for our needs for compressed CDDA audio (but still has the same original API). All that to say, it's own own file to mangle and maintain for now (it's received lots of prior PVS and Coverity fixes, as well as warning cleanups). I see SDL has kind of brought back SDL2_Sound to life.. so maybe we can externalize it and toss this file down the road. |
@weirddan455 , I've sent an invite from the (clunky) Coverity system. Should appear in your email. When you visit, there should be a grey button "Login with GitHub", should get you in without any passwords or account details needed. https://scan.coverity.com/projects/dosbox-staging
Once in the defect dashboard, use the burger in the upper-left and select "all in project": And from there, click on one of the outstanding quantities: |
(@johnnovak - oh, I see you're not in the list too; invite sent) |
Coverity maps each issue to a Common Weakness Enumeration: CWE, which is automatic justification for the fix 😄 ! You can see prior fixes with:
|
Thanks for the invite @kcgen I was able to get logged in. Working with upstream seems like a good policy then.
That is probably for the best. It would potentially remove a couple dependencies as well. I believe libvorbis and speex are only needed for SDL Sound? https://github.com/icculus/SDL_sound
They've done away with those requirements for the SDL Sound 2.0 release. Are we trying to release 0.81 in the near future though? If so, we may want to wait on updating that until post-release in case there's regressions. As far as I can tell, the SDL Sound stuff has "just worked" for us for a while now so if there's not much user facing benefit we can probably wait. Although I do think it would eliminate some tech debt to update maybe after 0.81. |
DOSBox Staging's SDL_Sound
👍
These aren't DOSBox Staging dependencies (we don't use either of them). Our SDL_Sound only has If you're seeing
When I was working on the original CD-DA FLAC/Opus/MP3 patch for upstream DOSBox, I chatted w/ Ryan from SDL about including Opus in SDL_Sound and he was interested, however the new goal of minimizing dependencies was a priority and so Opus wasn't added. David Reid (of dr_libs) does have an Opus request ticket and has been chipping away at realizing So that's a big functional gap; we can't moved until SDL_Sound 2 has Opus support. A second difference is that our SDL_Sound set s up an MP3 fast seek table (and caches it to disk). Some games use a single giant audio track and seek within it for music and voice sequences. On slow(er) hardware, seeking to PCM-exact frames can be very slow.
Yes to all (in the immediate term), but also longer term I don't see up migrating until SDL2_Sound supports Opus and the MP3 fast seek tables. But there's probably a hybrid approach that gets us closer (also, just a longer term goal): We could fork SDL2_Sound into the But yeah.. that's longer term. |
Yeah, sorry it was libopus I was thinking of, not libvorbis. I guess we're using stb_vorbis which is in-tree. Speex is a dependency of something though, we even have a wrap for it. Lines 525 to 535 in 904cb68
But, OK point taken about SDL Sound. We have essentially our own fork of that then. I think you should leave that Coverity warning in the original post and we can potentially fix that ourselves (and not worry about upstream). It was marked a use after free bug so it could be something serious. I also saw the |
Isn't speexdsp used for audio resampling in DOSBox? I seem to recall that's the reason for it's inclusion. |
no worries; easy to mix them up (all the Xiph libs :-)
Yup. (@weirddan455 )
(@shermp )
Yup, Speex DSP is our resampler - it's confusing because it's an off-shoot from Xiph's compression codec (Speex), but just the DSP resampler (without the Speex codec). It's super-efficient, small, and has a nice API. |
Roger that; will re-add. It's actually a very stubborn issue in the code that I've tried to fix before. Having you help squash that would be a big help, @weirddan455 👍 ! |
Updating you here @weirddan455 because you rarely show up at our chat. Btw, will send you an invite to our private channel once you register a permanent Discord account. The team has decided in the past few days that we'll switch to a release candidate style process. In addition to that, I'll be offline for three weeks from Wednesday and I have some outstanding stuff to finish, some of which will likely only happen when I'm back. This means that we can cut a release around early Dec in the ideal scenario, then release it this year after say 2 weeks of internal testing. And yes, we need the resampler from Speex; the whole audio pipeline depends on it, that's something I introduced last year. Thanks for the Coverity invite @kcgen. |
Thanks for the quick release plan here, @johnnovak -- relayed to @GranMinigun and @Grounded0. |
Part of issue #2996 Coverity is reporting a use after free bug in Sound_Quit. It doesn't look like an actual bug since the code only removes elements from the head of the linked list. Add an assert so hopefully Coverity sees that we never take the "broken" branch.
This warning is an annoying micro-optimization: dosbox-staging/src/gui/sdlmain.cpp Lines 4673 to 4681 in 904cb68
There's nothing wrong with this code as far as I'm concerned. I believe I touched this code when I refactored command line argument parsing. It's complaining that it's making a copy of a |
Found by Coverity. This is clearly wrong. It's trying to do a bitwise AND mask of the bottom 16 bits but was incorrectly using a logical and. Part of #2996
Fixes two warnings found by Coverity in #2996
Raised an issue upstream with stb: nothings/stb#1528 |
Part of issue #2996 Coverity is reporting a use after free bug in Sound_Quit. It doesn't look like an actual bug since the code only removes elements from the head of the linked list. Add an assert so hopefully Coverity sees that we never take the "broken" branch.
Found by Coverity. This is clearly wrong. It's trying to do a bitwise AND mask of the bottom 16 bits but was incorrectly using a logical and. Part of #2996
Fixes two warnings found by Coverity in #2996
This is a 2nd attempt at fixing a Coverity issue #2996 It potentially fixes a data race (not sure if this is what Coverity saw) Sound_FreeSample also takes a lock but SDL's mutex is recursive so this should be fine.
This is a 2nd attempt at fixing a Coverity issue #2996 It potentially fixes a data race (not sure if this is what Coverity saw) Sound_FreeSample also takes a lock but SDL's mutex is recursive so this should be fine.
I edited the OP to remove the issue's I've fixed. SDL Sound is still problematic. I'm explicitly passing in But somehow Coverity saw my assert and decided that |
As a side note, while I'm pretty sure this is going to be a false positive, we could avoid this issue by refactoring to replace the handrolled linked list with a Maybe I'll put this as a TODO for after 0.81. |
👍 ; marked.
Yup; although this is surely a bug in Coverity, we can take its struggles as a sign that there's way too much opaque pointer casting stuff going on. The API is perfect fit for a pure-virtual base class that avoids all the void-pointer casting internals, as well. I suspect a lot of internal code would disappear. |
I think this has been wrapped up; thanks for all the fixes, @weirddan455. |
These are all very minor and likely need just a line or two to fix up.
Feel free to grab any of them and push single fix up PRs.
The text was updated successfully, but these errors were encountered: