MT#57011 app_lua: fix crash on exhausted memory scenario

Change-Id: Ic10d04559f53deaa552fd808cac88d10f11d35b2
mr11.3
Victor Seva 3 years ago
parent 3351788015
commit 831a1475ea

@ -42,6 +42,7 @@ upstream/dialog-dlg_get_var-assure-return-null-on-error.patch
upstream/dialog-w_dlg_get_var-fix-incompatible-pointer.patch
sipwise/dialog-dlg_get_var-changes-in-API.patch
upstream/presence-No-autocommit-rollback-if-no-active-watcher.patch
upstream/app_lua-fix-crash-on-exausted-memory-scenario.patch
### relevant for upstream
sipwise/Makefile-support-parallelism-on-install-modules-doc-.patch
sipwise/pua_dialoginfo-refresh_pubruri_avps_flag.patch

@ -0,0 +1,34 @@
From: Victor Seva <vseva@sipwise.com>
Date: Fri, 24 Mar 2023 10:26:15 +0100
Subject: app_lua: fix crash on exausted memory scenario
---
src/modules/app_lua/app_lua_api.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/modules/app_lua/app_lua_api.c b/src/modules/app_lua/app_lua_api.c
index 0a1d135..1010fc5 100644
--- a/src/modules/app_lua/app_lua_api.c
+++ b/src/modules/app_lua/app_lua_api.c
@@ -912,6 +912,10 @@ void sr_kemi_lua_push_dict(lua_State *L, sr_kemi_dict_item_t *item) {
void
sr_kemi_lua_push_dict_item(lua_State *L, sr_kemi_dict_item_t *item)
{
+ if(!item) {
+ LM_CRIT("BUG: dict field empty\n");
+ return;
+ }
switch(item->vtype) {
case SR_KEMIP_NONE:
LM_CRIT("BUG: vtype is NONE\n");
@@ -951,6 +955,10 @@ sr_kemi_lua_push_dict_item(lua_State *L, sr_kemi_dict_item_t *item)
*/
int sr_kemi_lua_return_xval(lua_State* L, sr_kemi_t *ket, sr_kemi_xval_t *rx)
{
+ if(!rx) {
+ LM_CRIT("BUG: xval field empty\n");
+ return 0;
+ }
switch(rx->vtype) {
case SR_KEMIP_NONE:
return 0;
Loading…
Cancel
Save