Inside3D!
     

Nvidia 191.xx drivers bugfix.

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming
View previous topic :: View next topic  
Author Message
Irritant



Joined: 19 May 2008
Posts: 115
Location: Maryland

PostPosted: Wed Oct 14, 2009 4:35 am    Post subject: Nvidia 191.xx drivers bugfix. Reply with quote

Nice job Nvidia. 191.xx drivers blow up alot of Quake engines.

The fix is to replace vsprintf with _vsnprintf. Ugg.

Kirk Barnes gets credit for finding this...
_________________
http://red.planetarena.org - Alien Arena
Back to top
View user's profile Send private message Visit poster's website
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Wed Oct 14, 2009 9:20 am    Post subject: Reply with quote

If you're sprinting the gl extensions string into a buffer somewhere without checking the length of it, then its your own damn fault. Or more likely Id's...
Just copying any unbounded string of unknown length to a fixed-length string is always bad.
By using vsnprintf instead, you're truncating the string. There might have been something important in there.

Q1 engines crashed because of overlong extension strings years and years ago.
It surprises me that there are engines out there that are still susceptible.
Unless you're talking about something else...

If I remember correctly, NVidia provide some registry keys to choose which extensions to hide from apps. It just stops claiming it supports it. Feel free to cripple your drivers so that quake runs again without being fixed.

Note that GL_EXTENSIONS is depricated in opengl v3. There's a different mechanism that queries extensions by number instead. In part so that developers stop blindly copying extension strings into other buffers then strstring for the extension names they want... as that is also bad practice.
Strict opengl3 is annoying.

Sorry... But nvidia are not to blame.
Chances are they detect glquake and trim off some of the extensions that glquake never used... And no longer ever can. At least this is what will happen if you complain to them.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
mh



Joined: 12 Jan 2008
Posts: 909

PostPosted: Wed Oct 14, 2009 9:30 am    Post subject: Reply with quote

You shouldn't be relying on querying the extension string anyway; we all know of drivers that report support for a particular extension but that don't actually support it properly, if at all. Best approach is to test for entry points (if applicable) and set up a flag indicating if a feature is present or not based on that. It's also worthwhile doing an API call (or calls) and checking the result of glGetError () as part of your setup.

Bottom line with OpenGL is that drivers cannot be relied on to behave themselves properly, so you need to take on responsibility for ensuring that stuff works yourself.
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
Irritant



Joined: 19 May 2008
Posts: 115
Location: Maryland

PostPosted: Wed Oct 14, 2009 2:38 pm    Post subject: Reply with quote

Yes, to clarify, the errors were occuring in the extension checking of quake 1 and quake 2 engines. Q3 fixed the problem using vsnprintf.
_________________
http://red.planetarena.org - Alien Arena
Back to top
View user's profile Send private message Visit poster's website
Tomaz



Joined: 05 Nov 2004
Posts: 49

PostPosted: Wed Oct 14, 2009 2:46 pm    Post subject: Re: Nvidia 191.xx drivers bugfix. Reply with quote

Irritant wrote:
Nice job Nvidia. 191.xx drivers blow up alot of Quake engines.

The fix is to replace vsprintf with _vsnprintf. Ugg.

Kirk Barnes gets credit for finding this...


That "bug" happened years ago. It's been fixed in just about any engine that has been run on anything newer than a GeForce 2 card.

A similar bug happens with the larger monitors of today, one of the arrays in gl_vidnt.c isn't big enough to hold all the resolutions the newer monitor/3d cards support.
Back to top
View user's profile Send private message
mh



Joined: 12 Jan 2008
Posts: 909

PostPosted: Wed Oct 14, 2009 4:03 pm    Post subject: Reply with quote

Ain't that big a deal as you should always be using _vsnprintf anyway...
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
Irritant



Joined: 19 May 2008
Posts: 115
Location: Maryland

PostPosted: Wed Oct 14, 2009 4:59 pm    Post subject: Reply with quote

This was something in the id code, nothing that other people put in.

Alot of engines didn't change this, contrary to what Tomaz posted.

This is really the first I'd heard of it. I've never experienced crashes because of this until the 191.xx drivers came out.
_________________
http://red.planetarena.org - Alien Arena
Back to top
View user's profile Send private message Visit poster's website
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Mon Nov 02, 2009 9:54 am    Post subject: Reply with quote

another one to add

Code:
void Sys_PumpMessages (void) {
    MSG      msg;
   while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
      if (!GetMessage(&msg, NULL, 0, 0)) {
         Sys_Quit();
      }
      sys_msgTime = msg.time;
        TranslateMessage(&msg);
        DispatchMessage(&msg);
   }

   // Grab frame time
   sys_frameTime = timeGetTime();   // FIXME: should this be at start?
}


q2evolved crashes in this on windows 7 with cant read the expression. i applied the fix but still crashes here so not sure where the culprit may be.
Back to top
View user's profile Send private message
mh



Joined: 12 Jan 2008
Posts: 909

PostPosted: Mon Nov 02, 2009 12:46 pm    Post subject: Reply with quote

Just put the 191 drivers on my main machine. It seems that the cause of this is not actually the overlong extension string, but the fact that the "trim extension string" option in the Nvidia control panel defaults to false, and the list of applications which have special settings is substantially reduced (none of the Quakes are there).
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group