freeradius-server icon indicating copy to clipboard operation
freeradius-server copied to clipboard

[defect]: some type-incorrect unlang code can trigger an assertion when executed

Open jejones3141 opened this issue 1 year ago • 3 comments

What type of defect/bug is this?

Crash or memory corruption (segv, abort, etc...)

How can the issue be reproduced?

  1. Replace the contents of src/tests/modules/redis/cluster_reset.inc with those of the attached file cluster_reset.txt (renamed so github would accept it). Then

MODULE_TEST_DIR=src/tests/modules/redis/ MODULE_TEST_UNLANG=src/tests/modules/redis/cluster_key.unlang build/make/jlibtool --silent --timeout=300 --mode=execute ./build/bin/local/unit_test_module -D share/dictionary -d src/tests/modules/ -i "build/tests/modules/redis/cluster_key.attrs" -f "build/tests/modules/redis/cluster_key.attrs" -r "build/tests/modules/redis/cluster_key" -xx

The redis cluster key test will fail while trying to execute

if ((%redis(-@%redis.node('b','1'),'GET','b') == "%{control.Tmp-String-0}") && \
     (%redis(-@%redis.node('c','1'),'GET','c') == "%{control.Tmp-String-1}") && \
     (%redis(-@%redis.node('d','1'),'GET','d') == "%{control.Tmp-String-2}")) {
	break
}

The full output is in debug_log.txt. Selected output appears in the "relevant log output" section below.

Log output from the FreeRADIUS daemon

This issue shows up when running a test, rather than in the operation of the FreeRADIUS daemon.

Relevant log output from client utilities

Debug : (0)            if ((%redis(-@%redis.node('b','1'),'GET','b') == "%{control.Tmp-String-0}") &&                       (%redis(-@%redis.node('c','1'),'GET','c') == "%{control.Tmp-String-1}") &&                        (%redis(-@%redis.node('d','1'),'GET','d') == "%{control.Tmp-String-2}"))  {
Debug : (0)              | &&
Debug : (0)                | ==
Debug : (0)              | %logical_and()
Debug : (0)                    | %redis(-@%redis.node('b','1'),'GET','b')
Debug : (0)                      | %{%redis(-@%redis.node('b','1'),'GET','b')}
Debug : (0)                      | redis
Debug : (0)                            Key "b" -> slot 3300
Debug : (0)                          | %redis.node({b}{1})
Debug : (0)                          | --> 127.0.0.1:30004
Debug : (0)                        0 of 0 connections in use.  You  may need to increase "spare"
Debug : (0)                        Opening additional connection (0), 1 of 12 pending slots used
Debug : rlm_redis (redis) - [6] Connecting to node 127.0.0.1:30004
Debug : (0)                        Reserved connection (0)
Debug : (0)                        Executing command: GET
Debug : (0)                        With arguments
Debug : (0)                          [1] b
Debug : (0)                      | %redis({-@, 127.0.0.1:30004}{GET}{b})
Debug : (0)                      | --> NULL
Debug : (0)                    | cast
Debug : (0)                        | %{control.Tmp-String-0}
Debug : (0)                          | %{%{control.Tmp-String-0}}
Debug : (0)                          | control.Tmp-String-0
Debug : (0)                            | %{control.Tmp-String-0}
Debug : (0)                            | --> 1-ipsKGrCH
Debug : (0)                    | %cast({string}{1-ipsKGrCH})
Debug : (0)                    | --> 1-ipsKGrCH
ASSERT FAILED src/lib/util/calc.c[2697]: dst->type == FR_TYPE_BOOL
CAUGHT SIGNAL: Aborted

Backtrace from LLDB or GDB

No response

jejones3141 avatar Dec 20 '23 17:12 jejones3141

can you reformat the log so that it's readable? Put the text into a block in between triple quotes, and it should work

a
b

alandekok avatar Dec 20 '23 18:12 alandekok

Done.

jejones3141 avatar Dec 20 '23 19:12 jejones3141

Is the bug fixed? If not, it should remain open.

alandekok avatar Dec 21 '23 13:12 alandekok