[Ffmpeg-devel] Re: [PATCH] http seeking

Michael Niedermayer michaelni
Mon Dec 11 19:34:20 CET 2006


Hi

On Sun, Dec 10, 2006 at 07:00:02PM -0500, Ronald S. Bultje wrote:
> On Sun, 2006-12-10, Aurelien Jacobs:
> > Not attached...
> 
> ^##^## Let me try that again. If it doesn't work, it's also on
> http://ronald.bitfreak.net/priv/ffhttpseek.patch (I probably just forgot
> to attach, though).

[...]

>   redo:
> +    pstrcpy(location, URL_SIZE, s->location);
>      /* needed in any case to build the host string */
>      url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
> -              path1, sizeof(path1), uri);
> +              path1, sizeof(path1), location);
>      if (port > 0) {
>          snprintf(hoststr, sizeof(hoststr), "%s:%d", hostname, port);
>      } else {
> @@ -92,7 +87,7 @@
>      if (use_proxy) {
>          url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
>                    NULL, 0, proxy_path);
> -        path = uri;
> +        path = location;
>      } else {
>          if (path1[0] == '\0')
>              path = "/";
> @@ -112,18 +107,38 @@
>          goto fail;
>      if (s->http_code == 303 && s->location[0] != '\0') {
>          /* url moved, get next */
> -        uri = s->location;
>          url_close(hd);
>          goto redo;
>      }
> +    pstrcpy(s->location, URL_SIZE, location);

can this strcpy() mess not be suppressed? what about droping
s->location[0] = '\0';
?
or has this some sideeffects?


and rather do a 
if (s->http_code == 303 && retry_count--) {
instead of
if (s->http_code == 303 && s->location[0] != '\0') {

this also fixes a possible DOS attack issue if a mallicious server
sends redirects with the same url ad infinitum


[...]
> +	    s->len += s->off; /* starting offset is subtracted */

tabs are forbidden in svn ...


[...]
> +    printf("Seek to %lld, len=%lld, type=%d\n", off, s->len, whence);

printf -> av_log


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus




More information about the ffmpeg-devel mailing list