Author: tkreuzer Date: Wed Feb 11 21:36:01 2015 New Revision: 66232
URL: http://svn.reactos.org/svn/reactos?rev=66232&view=rev Log: [MESA] Partly sync find_value() with MESA 10.4.4. Fixes endless loop when GoogleEarth is started. GoogleEarth now loads and displays the earth, but it doesn't handle any input and makes the entire GUI hang.
Modified: trunk/reactos/dll/opengl/mesa/main/get.c
Modified: trunk/reactos/dll/opengl/mesa/main/get.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/opengl/mesa/main/get.c?... ============================================================================== --- trunk/reactos/dll/opengl/mesa/main/get.c [iso-8859-1] (original) +++ trunk/reactos/dll/opengl/mesa/main/get.c [iso-8859-1] Wed Feb 11 21:36:01 2015 @@ -1132,10 +1132,20 @@ mask = Elements(table) - 1; hash = (pname * prime_factor); while (1) { - d = &values[table[hash & mask]]; - + int idx = table[hash & mask]; + + /* If the enum isn't valid, the hash walk ends with index 0, + * pointing to the first entry of values[] which doesn't hold + * any valid enum. */ + if (unlikely(idx == 0)) { + _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func, + _mesa_lookup_enum_by_nr(pname)); + return &error_value; + } + + d = &values[idx]; if (likely(d->pname == pname)) - break; + break;
hash += prime_step; }