Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5afdc877 authored by Jack Palevich's avatar Jack Palevich
Browse files

Add size checks for glBufferData and glBufferSubData

Without the size checks it's possible for calls to glBufferData
and glBufferSubData to read off the end of the Buffer object's
data, which can cause page faults.

Fix end-of-line characters for the "spec" files. (That's why
every line of these files is changed.)

Enhance our code emitter to properly handle bounds checks for
possibly-null pointers.
parent 7793548d
Loading
Loading
Loading
Loading
+62 −61
Original line number Diff line number Diff line
@@ -23,7 +23,8 @@ glPointParameter check params 1
glTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR
glTexImage2D nullAllowed
glTexSubImage2D nullAllowed
glBufferData nullAllowed
glBufferData nullAllowed check data size
glBufferSubData check data size
glTexParameter check params 1
glQueryMatrixxOES check mantissa 16 check exponent 16 return -1
glDrawTexfvOES check coords 5
+60 −59
Original line number Diff line number Diff line
@@ -21,7 +21,8 @@ glPointParameter check params 1
glTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR
glTexImage2D nullAllowed
glTexSubImage2D nullAllowed
glBufferData nullAllowed
glBufferData nullAllowed check data size
glBufferSubData check data size
glTexParameter check params 1
glQueryMatrixxOES check mantissa 16 check exponent 16 return -1
glDrawTexfvOES check coords 5
+5 −5
Original line number Diff line number Diff line
@@ -907,13 +907,13 @@ public class JniCodeEmitter {
                                    ");");
                    }

                    emitNativeBoundsChecks(cfunc, cname, out, true,
                                           emitExceptionCheck,
                                           offset, remaining, nullAllowed ? "        " : "    ");

                    if (nullAllowed) {
                        out.println(indent + "}");
                    }

                    emitNativeBoundsChecks(cfunc, cname, out, true,
                                           emitExceptionCheck,
                                           offset, remaining, "    ");
                }
            }
        }