jookies / jasmin

Jasmin - Open source SMS gateway
http://jasminsms.com
Other
1.01k stars 550 forks source link

Coding crash amqp #1066

Closed vbodarev closed 2 years ago

vbodarev commented 2 years ago

If I send message with coding=6 or coding=8 get error and amqp crash. After this messages can't be sent.

If diasble DLR request (&drl=yes) - everything is ok.

I try ubuntu, debian and docker - same issue.

Reason for termination == {function_clause,[{rabbit_binary_parser,parse_table,[<<190,208,180,209,130,208,178,208,181,6,100,108,114,95,105,100,83,0,0,0,8,51,54,51,50,53,53,52,48,8,100,108,114,95,115,116,97,116,83,0,0,0,7,69,88,80,73,82,69,68>>],[{file,"src/rabbit_binary_parser.erl"},{line,41}]},{rabbit_binary_parser,parse_table,1,[{file,"src/rabbit_binary_parser.erl"},{line,43}]},{rabbit_framing_amqp_0_9_1,decode_properties,2,[{file,"src/rabbit_framing_amqp_0_9_1.erl"},{line,934}]},{rabbit_binary_parser,ensure_content_decoded,1,[{file,"src/rabbit_binary_parser.erl"},{line,146}]},{rabbit_channel,handle_method,3,[{file,"src/rabbit_channel.erl"},{line,1343}]},{rabbit_channel,handle_cast,2,[{file,"src/rabbit_channel.erl"},{line,630}]},{gen_server2,handle_msg,2,[{file,"src/gen_server2.erl"},{line,1067}]},{proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,236}]}]} 2022-07-24 04:51:01.462 [error] <0.11401.1> Error on AMQP connection <0.11401.1> (127.0.0.1:55230 -> 127.0.0.1:5672, vhost: '/', user: 'guest', state: running), channel 1:

vbodarev commented 2 years ago

The problem is in jasmin/managers/listeners.py:741

In dlr_details=routable.pdu.dlr {'dlvrd': '001', 'sub': '001', 'sdate': '2207281632', 'ddate': '2207281632', 'err': '000', 'text': '-------------', 'id': b'36F9227F', 'stat': 'DELIVRD'}

If 'text' is binary AMQP will crash

Can fix the issue, but need better way (decode message before amqpBroker.publish) routable.pdu.dlr['text'] = ''