Skip to content

Commit 781393f

Browse files
[lib_nbgl]: Add a protection to forbid drawing a screen owned by someone else
1 parent e99b09a commit 781393f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib_nbgl/src/nbgl_obj.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "os_print.h"
1919
#include "os_helpers.h"
2020
#include "os_pic.h"
21+
#include "os_task.h"
2122
#include "glyphs.h"
2223
#include "os_io_seph_ux.h"
2324
#ifdef HAVE_SERIALIZED_NBGL
@@ -1621,7 +1622,7 @@ static void extendRefreshArea(nbgl_area_t *area)
16211622
void nbgl_objDraw(nbgl_obj_t *obj)
16221623
{
16231624
bool computePosition = false;
1624-
bool fromApp;
1625+
bool fromApp = false;
16251626

16261627
LOG_DEBUG(OBJ_LOGGER, "nbgl_objDraw(): obj = %p\n", obj);
16271628
// check whether it's necessary to compute position, and if this object belongs to
@@ -1645,6 +1646,10 @@ void nbgl_objDraw(nbgl_obj_t *obj)
16451646
fromApp = false;
16461647
}
16471648
}
1649+
// forbid redrawing App screens by UX or vice versa
1650+
if ((os_sched_current_task() == TASK_BOLOS_UX) == fromApp) {
1651+
return;
1652+
}
16481653
// actually draw the object and its children, if it is allowed
16491654
if (objDrawingDisabled && fromApp) {
16501655
return;

0 commit comments

Comments
 (0)