Merge change Ic620a52b into eclair

* changes:
  Add size checks for glBufferData and glBufferSubData
This commit is contained in:
Android (Google) Code Review
2009-10-23 20:30:33 -04:00
5 changed files with 151 additions and 125 deletions

View File

@ -144,6 +144,10 @@ android_glBufferData__IILjava_nio_Buffer_2I
if (data_buf) {
data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
if (_remaining < size) {
_env->ThrowNew(IAEClass, "remaining() < size");
goto exit;
}
}
glBufferData(
(GLenum)target,
@ -151,6 +155,8 @@ android_glBufferData__IILjava_nio_Buffer_2I
(GLvoid *)data,
(GLenum)usage
);
exit:
if (_array) {
releasePointer(_env, _array, data, JNI_FALSE);
}
@ -165,12 +171,18 @@ android_glBufferSubData__IIILjava_nio_Buffer_2
GLvoid *data = (GLvoid *) 0;
data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
if (_remaining < size) {
_env->ThrowNew(IAEClass, "remaining() < size");
goto exit;
}
glBufferSubData(
(GLenum)target,
(GLintptr)offset,
(GLsizeiptr)size,
(GLvoid *)data
);
exit:
if (_array) {
releasePointer(_env, _array, data, JNI_FALSE);
}

View File

@ -3593,6 +3593,10 @@ android_glBufferData__IILjava_nio_Buffer_2I
if (data_buf) {
data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
if (_remaining < size) {
_env->ThrowNew(IAEClass, "remaining() < size");
goto exit;
}
}
glBufferData(
(GLenum)target,
@ -3600,6 +3604,8 @@ android_glBufferData__IILjava_nio_Buffer_2I
(GLvoid *)data,
(GLenum)usage
);
exit:
if (_array) {
releasePointer(_env, _array, data, JNI_FALSE);
}
@ -3614,12 +3620,18 @@ android_glBufferSubData__IIILjava_nio_Buffer_2
GLvoid *data = (GLvoid *) 0;
data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
if (_remaining < size) {
_env->ThrowNew(IAEClass, "remaining() < size");
goto exit;
}
glBufferSubData(
(GLenum)target,
(GLintptr)offset,
(GLsizeiptr)size,
(GLvoid *)data
);
exit:
if (_array) {
releasePointer(_env, _array, data, JNI_FALSE);
}

View File

@ -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

View File

@ -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

View File

@ -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, " ");
}
}
}