[FFmpeg-devel] [PATCH 1/2] lavf/url: add ff_url_decompose().

Nicolas George george at nsup.org
Tue Aug 4 12:16:09 EEST 2020


Marton Balint (12020-08-04):
> So you are returning NULL pointers here and success at the same time. This
> does not look like a good idea, e.g. checking fields later on involves
> arithmetic on NULL pointers, no? I don't really see it useful that we handle
> NULL url here, we are better off with an assert IMHO.

It only involves NULL+0 and NULL-NULL. But I see your concern. I removed
this hunk and added instead:

    if (!base)
	base = "";

just before the call in the second patch.

> This is the only place where we might return failure. Maybe we could convert
> this to void() function to simplify usage a bit, and either
> - assume no port, if it is not paraseable or
> - not split host and port, so we don't have to parse IPv6 mess here,
> therefore the error can't happen.

I think catching invalid input as early and as often as possible is
best. We need to update callers of ff_make_absolute_url() to handle
truncated output anyway.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200804/1c7001bf/attachment.sig>


More information about the ffmpeg-devel mailing list