summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Vorobiov <s.vorobiov@samsung.com>2014-04-28 19:36:33 +0400
committerStanislav Vorobiov <s.vorobiov@samsung.com>2014-04-28 19:41:11 +0400
commit2abd29878f2f3b1cbd9cbb4c9cb0e64d5335be8f (patch)
tree960a4224614f6a66ade3239432db9c0b8b89035b
parent4c32c4bdf060879a4b00701f082935d40776fe2b (diff)
downloademulator-yagl-2abd29878f2f3b1cbd9cbb4c9cb0e64d5335be8f.tar.gz
emulator-yagl-2abd29878f2f3b1cbd9cbb4c9cb0e64d5335be8f.tar.bz2
emulator-yagl-2abd29878f2f3b1cbd9cbb4c9cb0e64d5335be8f.zip
YaGL: Fix glTexImageXXX NULL pointer offset bugsubmit/tizen/20140428.162945
If we set non-0 GL_UNPACK_SKIP_XXX and call glTexImageXXX with NULL pointer then NULL will get offset and it'll result in guest app crash. We should offset NULL data pointer only if unpack PBO is bound, when no unpack PBO bound we should just calculate the size and don't offset the pointer Change-Id: Ie921016f0245f7042393cae98f04f80300bc85a1 Signed-off-by: Stanislav Vorobiov <s.vorobiov@samsung.com>
-rw-r--r--GLES_common/yagl_gles_calls.c9
-rw-r--r--GLESv2/yagl_gles2_calls.c9
2 files changed, 14 insertions, 4 deletions
diff --git a/GLES_common/yagl_gles_calls.c b/GLES_common/yagl_gles_calls.c
index 0d56a44..85bf0ca 100644
--- a/GLES_common/yagl_gles_calls.c
+++ b/GLES_common/yagl_gles_calls.c
@@ -2242,8 +2242,13 @@ YAGL_API void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLs
}
}
- pixels += yagl_pixel_format_get_info(pf, &ctx->unpack,
- width, height, 1, &size);
+ if (pixels || using_pbo) {
+ pixels += yagl_pixel_format_get_info(pf, &ctx->unpack,
+ width, height, 1, &size);
+ } else {
+ yagl_pixel_format_get_info(pf, &ctx->unpack,
+ width, height, 1, &size);
+ }
if (using_pbo) {
yagl_host_glTexImage2DOffset(target,
diff --git a/GLESv2/yagl_gles2_calls.c b/GLESv2/yagl_gles2_calls.c
index 8a5f5aa..8bc7e86 100644
--- a/GLESv2/yagl_gles2_calls.c
+++ b/GLESv2/yagl_gles2_calls.c
@@ -2447,8 +2447,13 @@ YAGL_API void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLs
goto out;
}
- pixels += yagl_pixel_format_get_info(pf, &ctx->base.unpack,
- width, height, depth, &size);
+ if (pixels || using_pbo) {
+ pixels += yagl_pixel_format_get_info(pf, &ctx->base.unpack,
+ width, height, depth, &size);
+ } else {
+ yagl_pixel_format_get_info(pf, &ctx->base.unpack,
+ width, height, depth, &size);
+ }
if (using_pbo) {
yagl_host_glTexImage3DOffset(target,