am a2ec1f4c: am 8f89a1a3: Merge change Ic620a52b into eclair

Merge commit 'a2ec1f4cea5531fb824b3fb2802ef4573a4916d9' into eclair-mr2-plus-aosp

* commit 'a2ec1f4cea5531fb824b3fb2802ef4573a4916d9':
  Add size checks for glBufferData and glBufferSubData
This commit is contained in:
Jack Palevich
2009-10-23 17:49:17 -07:00
committed by Android Git Automerger
5 changed files with 151 additions and 125 deletions

View File

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

View File

@@ -3593,6 +3593,10 @@ android_glBufferData__IILjava_nio_Buffer_2I
if (data_buf) { if (data_buf) {
data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
if (_remaining < size) {
_env->ThrowNew(IAEClass, "remaining() < size");
goto exit;
}
} }
glBufferData( glBufferData(
(GLenum)target, (GLenum)target,
@@ -3600,6 +3604,8 @@ android_glBufferData__IILjava_nio_Buffer_2I
(GLvoid *)data, (GLvoid *)data,
(GLenum)usage (GLenum)usage
); );
exit:
if (_array) { if (_array) {
releasePointer(_env, _array, data, JNI_FALSE); releasePointer(_env, _array, data, JNI_FALSE);
} }
@@ -3614,12 +3620,18 @@ android_glBufferSubData__IIILjava_nio_Buffer_2
GLvoid *data = (GLvoid *) 0; GLvoid *data = (GLvoid *) 0;
data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining);
if (_remaining < size) {
_env->ThrowNew(IAEClass, "remaining() < size");
goto exit;
}
glBufferSubData( glBufferSubData(
(GLenum)target, (GLenum)target,
(GLintptr)offset, (GLintptr)offset,
(GLsizeiptr)size, (GLsizeiptr)size,
(GLvoid *)data (GLvoid *)data
); );
exit:
if (_array) { if (_array) {
releasePointer(_env, _array, data, JNI_FALSE); 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 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 glTexImage2D nullAllowed
glTexSubImage2D nullAllowed glTexSubImage2D nullAllowed
glBufferData nullAllowed glBufferData nullAllowed check data size
glBufferSubData check data size
glTexParameter check params 1 glTexParameter check params 1
glQueryMatrixxOES check mantissa 16 check exponent 16 return -1 glQueryMatrixxOES check mantissa 16 check exponent 16 return -1
glDrawTexfvOES check coords 5 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 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 glTexImage2D nullAllowed
glTexSubImage2D nullAllowed glTexSubImage2D nullAllowed
glBufferData nullAllowed glBufferData nullAllowed check data size
glBufferSubData check data size
glTexParameter check params 1 glTexParameter check params 1
glQueryMatrixxOES check mantissa 16 check exponent 16 return -1 glQueryMatrixxOES check mantissa 16 check exponent 16 return -1
glDrawTexfvOES check coords 5 glDrawTexfvOES check coords 5

View File

@@ -907,13 +907,13 @@ public class JniCodeEmitter {
");"); ");");
} }
emitNativeBoundsChecks(cfunc, cname, out, true,
emitExceptionCheck,
offset, remaining, nullAllowed ? " " : " ");
if (nullAllowed) { if (nullAllowed) {
out.println(indent + "}"); out.println(indent + "}");
} }
emitNativeBoundsChecks(cfunc, cname, out, true,
emitExceptionCheck,
offset, remaining, " ");
} }
} }
} }