rbouqueau / gpac

GPAC mirror from the SourceForge Subversion
GNU Lesser General Public License v2.1
0 stars 1 forks source link

[Bug] DashCast: -vcustom and -acustom segfault [sf#328] #328

Closed rbouqueau closed 10 years ago

rbouqueau commented 10 years ago

Reported by jgrennison on 2014-08-27 14:34 UTC DashCast's -vcustom and -acustom switches generate a segfault if used with any string.

Taking the example of -vcustom, in dc_parse_command in cmd_data.c, it first does a strcmp(cmd_data->video_data_conf.custom, ""). However cmd_data->video_data_conf.custom is a char* which is implicitly initialised to a null pointer in dc_video_data_set_default. It then does a strncpy(cmd_data->audio_data_conf.custom, argv[i], GF_MAX_PATH), which has the same problem as no memory has been allocated. The only place it does seem to be initialised is in dc_read_configuration using gf_strdup.

rbouqueau commented 10 years ago

Commented by rbouqueau on 2014-08-27 16:16 UTC You're right. Seems like it was only tested thru a configuration file. I pushed a fix with commit 5373.

rbouqueau commented 10 years ago

Commented by jgrennison on 2014-08-28 09:06 UTC Many thanks, though on an additional note, the stored string will not be null-terminated if the input length is >= GF_MAX_PATH, and so will effectively have the next string appended, due to the behaviour of strncpy. This is probably not a significant problem, but I thought I'd point it out.

rbouqueau commented 10 years ago

Commented by rbouqueau on 2014-08-28 09:28 UTC Thanks. I've read strncpy doc and you're right. I'll fix it.

rbouqueau commented 10 years ago

Commented by rbouqueau on 2014-08-28 10:23 UTC Fixed in 5374

rbouqueau commented 10 years ago

Updated by rbouqueau on 2014-08-28 10:23 UTC