diff mbox series

libdvbv5: Don't assume that NIT table was parsed

Message ID 20190827132234.5252-1-mchehab+samsung@kernel.org (mailing list archive)
State New, archived
Headers show
Series libdvbv5: Don't assume that NIT table was parsed | expand

Commit Message

Mauro Carvalho Chehab Aug. 27, 2019, 1:22 p.m. UTC
It might happen that the NIT table doesn't get parsed.

As reported by Olcay, some transponders at Turksat-42.0E seem
to be missing the NIT table, causing dvb tools to crash with:

	Program received signal SIGSEGV, Segmentation fault.
	dvb_store_channel (dvb_file=0x7fffffffe460, __p=0x5555555605d0, dvb_scan_handler=0x555555565060, get_detected=0,
	    get_nit=0) at dvb-file.c:1345
	1345			if (dvb_scan_handler->nit->transport) {

As both transport ID and network ID are optional information,
verify if the nit table was parsed before trying fill them.

Reported-by: Olcay Korkmaz <olcay.krkmz@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
---
 lib/libdvbv5/dvb-file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index d077271a6546..474b59cb6fce 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -1342,7 +1342,7 @@  int dvb_store_channel(struct dvb_file **dvb_file,
 			dvb_log(_("Storing as channel %s"), channel);
 		vchannel = dvb_vchannel(parms, dvb_scan_handler->nit, service->service_id);
 
-		if (dvb_scan_handler->nit->transport) {
+		if (dvb_scan_handler->nit && dvb_scan_handler->nit->transport) {
 			network_id = dvb_scan_handler->nit->transport->network_id;
 			transport_id = dvb_scan_handler->nit->transport->transport_id;
 		}