On Wed, 5 Aug 2020, Nicolas George wrote:
Also add and update some tests. Change the semantic a little, because for filesytem paths symlinks complicate things. See the comments in the code for detail.
Add to commit message that this fixes tickets 8813, 8814.
Signed-off-by: Nicolas George <geo...@nsup.org> --- libavformat/tests/url.c | 60 ++++++++- libavformat/url.c | 261 ++++++++++++++++++++-------------------- libavformat/url.h | 4 +- tests/ref/fate/url | 54 ++++++++- 4 files changed, 245 insertions(+), 134 deletions(-)
[...]
+ if (keep > ub.path) + simplify_path = 0; + if (URL_COMPONENT_HAVE(uc, scheme)) + simplify_path = 0; + if (URL_COMPONENT_HAVE(uc, authority)) + simplify_path = 1;
You can move these after the use_base_path section but before the empty path check which also sets simplify_path.
+ + use_base_path = URL_COMPONENT_HAVE(ub, path) && keep <= ub.path; + if (uc.path > uc.url) + use_base_path = 0; + if (URL_COMPONENT_HAVE(uc, path) && uc.path[0] == '/') + use_base_path = 0; + if (use_base_path) { + base_path_end = ub.url_component_end_path; + if (URL_COMPONENT_HAVE(uc, path)) + while (base_path_end > ub.path && base_path_end[-1] != '/') + base_path_end--; } + if (!use_base_path && !URL_COMPONENT_HAVE(uc, path)) + simplify_path = 0;
[...]
+error:
Add TODO that this can be removed after all callers check return value
+ snprintf(buf, size, "invalid:%s", + ret == AVERROR(ENOMEM) ? "truncated" : + ret == AVERROR(EINVAL) ? "syntax_error" : ""); + return ret; }
With the comments above, LGTM, thanks. Regards, Marton _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".