[Ovmsdev] Some Bugs

Tom Parker tom at carrott.org
Sat Dec 16 17:59:19 HKT 2017


Hi all,

Master doesn't compile with the default sdkconfig when you answer no to 
all the questions:

/vagrant/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/main/./ovms_ota.cpp: 
In member function 'void OvmsOTA::AutoFlashSD(std::__cxx11::string, void*)':
/vagrant/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/main/./ovms_ota.cpp:432:18: 
error: 'class Peripherals' has no member named 'm_sdcard'

If you add in CONFIG_OVMS_COMP_SDCARD=y then it compiles.

There is a buffer overflow in the v2 command handling because we call 
strncpy with the length of the string not the (larger) length of the 
receiving buffer and so the null terminator is not copied. Later we read 
beyond the copied buffer because there is no null terminator. This often 
crashes the android client as it's not expecting junk data after the 
reply. The following encryption code doesn't include the null terminator 
either but I think that might be ok?

I've sent a pull request to fix the strncpy.

I've found the SIMCOM modem is very unstable when connected to my laptop 
via an unpowered USB hub. I see under-voltage warnings so I wonder if 
there isn't enough power? It seems stable when connected directly to my 
laptop. When it the modem reboots, the esp32 crashes too. I'm not sure 
if this is because it also ran out of power or because it is sad the 
network went away:


  (77496) SIMCOM ppp rx: 4b e5 0a aa c7 0f 1a d3 90 1f 26 03 4c 1c 00 00 
K.........&.L...
D (77506) SIMCOM ppp rx: 19 ac 50 18 39 08 05 3c 00 00 6d 2f 47 45 71 44 
..P.9..<..m/GEqD
D (77506) SIMCOM ppp rx: 78 41 78 51 3d 3d 0d 0a d6 17 7e                
xAxQ==....~
I (77536) ovms-server-v2: Incoming Msg: MP-0 Z2
I (77536) ovms-server-v2: One or more peers have connected
I (77536) ovms-server-v2: Send MP-0 
S0,K,0,0,stopped,standard,0,0,0,0,0,0,0,21,0,0,0,0,0.00,0,0,0,0,-1,0,0,0,0,0,0,0,0.00,0.00,0
I (77546) ovms-server-v2: Send MP-0 
D64,0,5,0,0,0,0,0,0,77,0,0,0,0,0.967033,0,0,0,0,0
I (77556) ovms-server-v2: Send MP-0 L0,0,0,0,0,0,0,0,0,0,0
I (77566) ovms-server-v2: Send MP-0 W0,0,0,0,0,0,0,0,0
I (77576) ovms-server-v2: Send MP-0 F3.0.0/factory/main build (idf 
v2.1-20-g88ab5d4) Dec 16 2017 09:23:50,,12,1,NL,VodafoneNZ Hologram
D (77936) SIMCOM rx: f9 0d ff 4b 0d 0a 55 4e 44 45 52 2d 56 4f 4c 54 
...K..UNDER-VOLT
D (77936) SIMCOM rx: 41 47 45 20 57 41 52 4e 4e 49 4e 47 20 50 4f 57 AGE 
WARNNING POW
D (77946) SIMCOM rx: 45 52 20 44 4f 57 4e 0d 0a 9b f9 f9 11 ff 4b 0d ER 
DOWN.......K.
D (77946) gsm-mux: ProcessFrame(CHAN=3, ADDR=0d, CTRL=ff, FCS=9b, LEN=43)
D (77946) gsm-mux: ChanProcessFrame(CHAN=3, ADDR=0d, CTRL=ff, LEN=40, IFP=3)
D (77946) SIMCOM line: 55 4e 44 45 52 2d 56 4f 4c 54 41 47 45 20 57 41 
UNDER-VOLTAGE WA
D (77946) SIMCOM line: 52 4e 4e 49 4e 47 20 50 4f 57 45 52 20 44 4f 57 
RNNING POWER DOW
D (77946) SIMCOM line: 4e                                              N
D (77946) SIMCOM rx: 0a 55 4e 44 45 52 2d 56 4f 4c 54 41 47 45 20 57 
.UNDER-VOLTAGE W
D (77946) SIMCOM rx: 41 52 4e 4e 49 4e 47 20 50 4f 57 45 52 20 44 4f 
ARNNING POWER DO
D (77946) SIMCOM rx: 57 4e 0d 0a 96 f9 f9 0d ff 45 0d 0a 73 74 61 72 
WN.......E..star
D (77946) gsm-mux: ProcessFrame(CHAN=4, ADDR=11, CTRL=ff, FCS=96, LEN=43)
D (77946) gsm-mux: ChanProcessFrame(CHAN=4, ADDR=11, CTRL=ff, LEN=40, IFP=3)
D (77946) SIMCOM line: 55 4e 44 45 52 2d 56 4f 4c 54 41 47 45 20 57 41 
UNDER-VOLTAGE WA
D (77946) SIMCOM line: 52 4e 4e 49 4e 47 20 50 4f 57 45 52 20 44 4f 57 
RNNING POWER DOW
D (77946) SIMCOM line: 4e                                              N
D (77946) SIMCOM rx: 74 69 6e 67 20 70 6f 77 65 72 20 6f 66 66 20 74 
ting power off t
D (77946) SIMCOM rx: 68 65 20 6d 6f 64 75 6c 65 21 0d 0a 71 f9 f9 11 he 
module!..q...
D (77946) gsm-mux: ProcessFrame(CHAN=3, ADDR=0d, CTRL=ff, FCS=71, LEN=40)
D (77946) gsm-mux: ChanProcessFrame(CHAN=3, ADDR=0d, CTRL=ff, LEN=37, IFP=3)
D (77946) SIMCOM line: 73 74 61 72 74 69 6e 67 20 70 6f 77 65 72 20 6f 
starting power o
D (77946) SIMCOM line: 66 66 20 74 68 65 20 6d 6f 64 75 6c 65 21       
ff the module!
D (77946) SIMCOM rx: ff 45 0d 0a 73 74 61 72 74 69 6e 67 20 70 6f 77 
.E..starting pow
D (77946) SIMCOM rx: 65 72 20 6f 66 66 20 74 68 65 20 6d 6f 64 75 6c er 
off the modul
D (77946) SIMCOM rx: 65 21 0d 0a 7c f9                               e!..|.
D (77946) gsm-mux: ProcessFrame(CHAN=4, ADDR=11, CTRL=ff, FCS=7c, LEN=40)
D (77946) gsm-mux: ChanProcessFrame(CHAN=4, ADDR=11, CTRL=ff, LEN=37, IFP=3)
D (77946) SIMCOM line: 73 74 61 72 74 69 6e 67 20 70 6f 77 65 72 20 6f 
starting power o
D (77946) SIMCOM line: 66 66 20 74 68 65 20 6d 6f 64 75 6c 65 21       
ff the module!
D (78216) SIMCOM ppp tx: 7e ff 03 80 57 01 01 00 0e 01 0a 85 b9 57 2f be 
~...W........W/.
D (78216) SIMCOM ppp tx: 63 a0 85 80 17 7e                               
c....~
D (78216) SIMCOM tx: f9 09 ff 2d 7e ff 03 80 57 01 01 00 0e 01 0a 85 
...-~...W.......
D (78216) SIMCOM tx: b9 57 2f be 63 a0 85 80 17 7e f5 f9             
.W/.c....~..
D (78566) SIMCOM rx: f9 09 ff cb 7e 21 45 00 00 60 92 81 40 00 2d 06 
....~!E..`.. at .-.
D (78566) SIMCOM rx: e0 ed bc 8a 4b e5 0a aa c7 0f 1a d3 90 1f 26 03 
....K.........&.
D (78566) SIMCOM rx: 4b e4 00 00 19 ac 50 18 39 08 79 ae 00 00 4d 50 
K.....P.9.y...MP
D (78576) SIMCOM rx: 2d 53 20 30 20 6a 79 30 32 65 51 6b 7a 55 52 4d -S 
0 jy02eQkzURM
D (78576) SIMCOM rx: 70 73 49 41 36 56 59 48 6e 39 59 20 58 72 5a 6b 
psIA6VYHn9Y XrZk
D (78576) SIMCOM rx: 64 71 48 7a 54 38 6a 77 74 44 47 46 66 6a 52 73 
dqHzT8jwtDGFfjRs
D (78576) SIMCOM rx: 79 77 3d 3d 0d 0a 58 bf 7e b9 f9                
yw==..X.~..
D (78576) gsm-mux: ProcessFrame(CHAN=2, ADDR=09, CTRL=ff, FCS=b9, LEN=107)
D (78576) gsm-mux: ChanProcessFrame(CHAN=2, ADDR=09, CTRL=ff, LEN=104, 
IFP=3)
D (78576) SIMCOM ppp rx: 7e 21 45 00 00 60 92 81 40 00 2d 06 e0 ed bc 8a 
~!E..`.. at .-.....
D (78576) SIMCOM ppp rx: 4b e5 0a aa c7 0f 1a d3 90 1f 26 03 4b e4 00 00 
K.........&.K...
D (78586) SIMCOM ppp rx: 19 ac 50 18 39 08 79 ae 00 00 4d 50 2d 53 20 30 
..P.9.y...MP-S 0
D (78586) SIMCOM ppp rx: 20 6a 79 30 32 65 51 6b 7a 55 52 4d 70 73 49 
41  jy02eQkzURMpsIA
D (78586) SIMCOM ppp rx: 36 56 59 48 6e 39 59 20 58 72 5a 6b 64 71 48 7a 
6VYHn9Y XrZkdqHz
D (78586) SIMCOM ppp rx: 54 38 6a 77 74 44 47 46 66 6a 52 73 79 77 3d 3d 
T8jwtDGFfjRsyw==
D (78596) SIMCOM ppp rx: 0d 0a 58 bf 7e                                  
..X.~
D (78596) SIMCOM ppp tx: 7e 21 45 00 00 28 00 08 00 00 ff 06 e1 9e 0a aa 
~!E..(..........
D (78596) SIMCOM ppp tx: c7 0f bc 8a 4b e5 90 1f 1a d3 00 00 1a 32 26 03 
....K........2&.
D (78596) SIMCOM ppp tx: 4c 2a 50 10 16 8a 87 cf 00 00 22 59 7e          
L*P......."Y~
D (78596) SIMCOM tx: f9 09 ff 5b 7e 21 45 00 00 28 00 08 00 00 ff 06 
...[~!E..(......
D (78596) SIMCOM tx: e1 9e 0a aa c7 0f bc 8a 4b e5 90 1f 1a d3 00 00 
........K.......
D (78596) SIMCOM tx: 1a 32 26 03 4c 2a 50 10 16 8a 87 cf 00 00 22 59 
.2&.L*P......."Y
D (78596) SIMCOM tx: 7e 45 f9                                        ~E.
D (78986) SIMCOM rx: f9 09 ff 23 7e ff 7d 23 c0 21 7d 25 7d 23 7d 20 
...#~.}#.!}%}#}
D (78986) SIMCOM rx: 7d 24 85 72 7e 1f f9 f9 0d ff 2f 0d 0a 2b 50 50 
}$.r~...../..+PP
D (78986) gsm-mux: ProGuru Meditation Error of type LoadProhibited 
occurred on core  1. Exception was unhandled.
Register dump:
PC      : 0x4017fd75  PS      : 0x00060b30  A0      : 0x8017fdb6 A1      
: 0x3ffcf030
0x4017fd75: ip4_route at 
/home/ubuntu/esp/esp-idf/components/lwip/core/ipv4/ip4.c:250 
(discriminator 2)

A2      : 0x0000f01d  A3      : 0x00000000  A4      : 0x3ffeb04c A5      
: 0x3f429a88
A6      : 0x00000008  A7      : 0x3ffcf258  A8      : 0x8017fd69 A9      
: 0x3ffcf010
A10     : 0x00000000  A11     : 0x00000000  A12     : 0x3ffdcd3c A13     
: 0x3ffcf240
A14     : 0x00000004  A15     : 0xab9423a7  SAR     : 0x00000018 
EXCCAUSE: 0x0000001c
EXCVADDR: 0x0000f0d2  LBEG    : 0x4000c349  LEND    : 0x4000c36b LCOUNT  
: 0x00000000

Backtrace: 0x4017fd75:0x3ffcf030 0x4017fdb3:0x3ffcf050 
0x4017dfa2:0x3ffcf070 0x40178617:0x3ffcf0b0 0x40178639:0x3ffcf0e0 
0x401786da:0x3ffcf100 0x40178b38:0x3ffcf120 0x4017c272:0x3ffcf140 
0x4017c2b3:0x3ffcf160 0x40184cdd:0x3ffcf180 0x401850a1:0x3ffcf1a0 
0x401850e8:0x3ffcf1c0 0x401894f9:0x3ffcf1e0 0x40184fd8:0x3ffcf200 
0x4018c9ce:0x3ffcf220 0x4018ca0a:0x3ffcf240 0x401880dd:0x3ffcf260 
0x40189b19:0x3ffcf280 0x40189bc4:0x3ffcf2a0 0x40187eff:0x3ffcf2c0 
0x40184b05:0x3ffcf2e0 0x401a2be8:0x3ffcf310 0x401a2d35:0x3ffcf330 
0x401731c9:0x3ffcf350
0x4017fd75: ip4_route at 
/home/ubuntu/esp/esp-idf/components/lwip/core/ipv4/ip4.c:250 
(discriminator 2)

0x4017fdb3: ip4_route_src at 
/home/ubuntu/esp/esp-idf/components/lwip/core/ipv4/ip4.c:159

0x4017dfa2: tcp_rst at 
/home/ubuntu/esp/esp-idf/components/lwip/core/tcp_out.c:1336 
(discriminator 4)

0x40178617: tcp_abandon at 
/home/ubuntu/esp/esp-idf/components/lwip/core/tcp.c:1630

0x40178639: tcp_abort at 
/home/ubuntu/esp/esp-idf/components/lwip/core/tcp.c:1630

0x401786da: tcp_netif_ipv4_addr_changed_pcblist at 
/home/ubuntu/esp/esp-idf/components/lwip/core/tcp.c:1630

0x40178b38: tcp_netif_ipv4_addr_changed at 
/home/ubuntu/esp/esp-idf/components/lwip/core/tcp.c:1947

0x4017c272: netif_set_ipaddr at 
/home/ubuntu/esp/esp-idf/components/lwip/core/netif.c:452

0x4017c2b3: netif_set_addr at 
/home/ubuntu/esp/esp-idf/components/lwip/core/netif.c:330

0x40184cdd: cifaddr at 
/home/ubuntu/esp/esp-idf/components/lwip/netif/ppp/ppp.c:704

0x401850a1: ipcp_clear_addrs at 
/home/ubuntu/esp/esp-idf/components/lwip/netif/ppp/ipcp.c:2192

0x401850e8: ipcp_down at 
/home/ubuntu/esp/esp-idf/components/lwip/netif/ppp/ipcp.c:2156

0x401894f9: fsm_lowerdown at 
/home/ubuntu/esp/esp-idf/components/lwip/netif/ppp/fsm.c:146

0x40184fd8: ipcp_lowerdown at 
/home/ubuntu/esp/esp-idf/components/lwip/netif/ppp/ipcp.c:687

0x4018c9ce: upper_layers_down at 
/home/ubuntu/esp/esp-idf/components/lwip/netif/ppp/auth.c:715

0x4018ca0a: link_down at 
/home/ubuntu/esp/esp-idf/components/lwip/netif/ppp/auth.c:701

0x401880dd: lcp_down at 
/home/ubuntu/esp/esp-idf/components/lwip/netif/ppp/lcp.c:2341

0x40189b19: fsm_rtermreq at 
/home/ubuntu/esp/esp-idf/components/lwip/netif/ppp/fsm.c:597

0x40189bc4: fsm_input at 
/home/ubuntu/esp/esp-idf/components/lwip/netif/ppp/fsm.c:369

0x40187eff: lcp_input at 
/home/ubuntu/esp/esp-idf/components/lwip/netif/ppp/lcp.c:513

0x40184b05: ppp_input at 
/home/ubuntu/esp/esp-idf/components/lwip/netif/ppp/ppp.c:704

0x401a2be8: pppos_input at 
/home/ubuntu/esp/esp-idf/components/lwip/netif/ppp/pppos.c:578

0x401a2d35: pppos_input_sys at 
/home/ubuntu/esp/esp-idf/components/lwip/netif/ppp/pppos.c:460 
(discriminator 3)

0x401731c9: tcpip_thread at 
/home/ubuntu/esp/esp-idf/components/lwip/api/tcpip.c:474


Rebooting...
ets Jun  8 2016 00:22:57




More information about the OvmsDev mailing list