summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2014-12-10 13:30:51 -0500
committerChris Michael <cp.michael@samsung.com>2014-12-10 13:30:51 -0500
commit251c300b8f908f573fbc0606cc4285db2ac724f7 (patch)
tree70485d9da7e30f245f1b7795185f8ab41eddbbe6 /src/modules
parent6e46642dfb8124b34c8733deae4b8d029e362f09 (diff)
evas-gl-common: Fix issue with Coverity reporting null dereferences
Summary: This fixes Coverity CID1257606 and CID1257607: Dereferencing null return value. _evgl_tls_resource_get Can return NULL so we should be checking that returned value before trying to use it @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_api.c82
1 files changed, 44 insertions, 38 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api.c b/src/modules/evas/engines/gl_common/evas_gl_api.c
index 2e3f980578..6e04c92aa1 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api.c
@@ -460,35 +460,38 @@ _evgl_glEnable(GLenum cap)
460 EVGL_Resource *rsc = _evgl_tls_resource_get(); 460 EVGL_Resource *rsc = _evgl_tls_resource_get();
461 int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0}, cc[4] = {0,0,0,0}; 461 int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0}, cc[4] = {0,0,0,0};
462 462
463 if (!ctx->current_fbo) 463 if (rsc)
464 { 464 {
465 // Direct rendering to canvas 465 if (!ctx->current_fbo)
466 if (!ctx->scissor_updated)
467 {
468 compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
469 rsc->direct.rot, 0,
470 0, 0, 0, 0,
471 rsc->direct.img.x, rsc->direct.img.y,
472 rsc->direct.img.w, rsc->direct.img.h,
473 rsc->direct.clip.x, rsc->direct.clip.y,
474 rsc->direct.clip.w, rsc->direct.clip.h,
475 oc, nc, cc);
476 glScissor(cc[0], cc[1], cc[2], cc[3]);
477 }
478 else
479 { 466 {
480 compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h, 467 // Direct rendering to canvas
481 rsc->direct.rot, 1, 468 if (!ctx->scissor_updated)
482 ctx->scissor_coord[0], ctx->scissor_coord[1], 469 {
483 ctx->scissor_coord[2], ctx->scissor_coord[3], 470 compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
484 rsc->direct.img.x, rsc->direct.img.y, 471 rsc->direct.rot, 0,
485 rsc->direct.img.w, rsc->direct.img.h, 472 0, 0, 0, 0,
486 rsc->direct.clip.x, rsc->direct.clip.y, 473 rsc->direct.img.x, rsc->direct.img.y,
487 rsc->direct.clip.w, rsc->direct.clip.h, 474 rsc->direct.img.w, rsc->direct.img.h,
488 oc, nc, cc); 475 rsc->direct.clip.x, rsc->direct.clip.y,
489 glScissor(nc[0], nc[1], nc[2], nc[3]); 476 rsc->direct.clip.w, rsc->direct.clip.h,
477 oc, nc, cc);
478 glScissor(cc[0], cc[1], cc[2], cc[3]);
479 }
480 else
481 {
482 compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
483 rsc->direct.rot, 1,
484 ctx->scissor_coord[0], ctx->scissor_coord[1],
485 ctx->scissor_coord[2], ctx->scissor_coord[3],
486 rsc->direct.img.x, rsc->direct.img.y,
487 rsc->direct.img.w, rsc->direct.img.h,
488 rsc->direct.clip.x, rsc->direct.clip.y,
489 rsc->direct.clip.w, rsc->direct.clip.h,
490 oc, nc, cc);
491 glScissor(nc[0], nc[1], nc[2], nc[3]);
492 }
493 ctx->direct_scissor = 1;
490 } 494 }
491 ctx->direct_scissor = 1;
492 } 495 }
493 else 496 else
494 { 497 {
@@ -533,20 +536,23 @@ _evgl_glDisable(GLenum cap)
533 int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0}, cc[4] = {0,0,0,0}; 536 int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0}, cc[4] = {0,0,0,0};
534 EVGL_Resource *rsc = _evgl_tls_resource_get(); 537 EVGL_Resource *rsc = _evgl_tls_resource_get();
535 538
536 compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h, 539 if (rsc)
537 rsc->direct.rot, 1, 540 {
538 0, 0, rsc->direct.img.w, rsc->direct.img.h, 541 compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
539 rsc->direct.img.x, rsc->direct.img.y, 542 rsc->direct.rot, 1,
540 rsc->direct.img.w, rsc->direct.img.h, 543 0, 0, rsc->direct.img.w, rsc->direct.img.h,
541 rsc->direct.clip.x, rsc->direct.clip.y, 544 rsc->direct.img.x, rsc->direct.img.y,
542 rsc->direct.clip.w, rsc->direct.clip.h, 545 rsc->direct.img.w, rsc->direct.img.h,
543 oc, nc, cc); 546 rsc->direct.clip.x, rsc->direct.clip.y,
547 rsc->direct.clip.w, rsc->direct.clip.h,
548 oc, nc, cc);
544 549
545 RECTS_CLIP_TO_RECT(nc[0], nc[1], nc[2], nc[3], cc[0], cc[1], cc[2], cc[3]); 550 RECTS_CLIP_TO_RECT(nc[0], nc[1], nc[2], nc[3], cc[0], cc[1], cc[2], cc[3]);
546 glScissor(nc[0], nc[1], nc[2], nc[3]); 551 glScissor(nc[0], nc[1], nc[2], nc[3]);
547 552
548 ctx->direct_scissor = 1; 553 ctx->direct_scissor = 1;
549 glEnable(GL_SCISSOR_TEST); 554 glEnable(GL_SCISSOR_TEST);
555 }
550 } 556 }
551 else 557 else
552 { 558 {