[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Libcdio-devel] New git branch for bug 45017 ? Or re-use branch for
From: |
Rocky Bernstein |
Subject: |
Re: [Libcdio-devel] New git branch for bug 45017 ? Or re-use branch for 45015 ? |
Date: |
Sun, 30 Jul 2017 19:30:10 -0400 |
This is great. Thanks. Just commit in the branch you checked out. Then git
push.
When the dust is settled, we'll give others a chance to review and comment
on before we merge that back into the main branch, which we'll make another
release from.
On Sun, Jul 30, 2017 at 2:22 PM, Thomas Schmitt <address@hidden> wrote:
> Hi,
>
> may i commit the following change for
>
> https://savannah.gnu.org/bugs/?45017
>
> (a neighbor of 45015) in the TS-RockRidge-Fix branch ?
> Or shall i ask for a TS-iso-info-Fix branch ?
>
> -----------------------------------------------------------------------
>
> diff --git a/src/iso-info.c b/src/iso-info.c
> index 212ab33..984d21a 100644
> --- a/src/iso-info.c
> +++ b/src/iso-info.c
> @@ -61,6 +61,13 @@
> #define NORMAL ""
> #endif
>
> +/* TODO: Find a better place from where cd-info can read it too. */
> +/*
> + ECMA-119 allows only a depth of 8 directories. Nobody obeys.
> + Rock Ridge allows path length 1023. This would be max depth 512.
> +*/
> +#define CDIO_MAX_DIR_RECURSION 512
> +
> /* Used by `main' to communicate with `parse_opt'. And global options
> */
> static struct arguments
> @@ -213,7 +220,8 @@ _log_handler (cdio_log_level_t level, const char
> message[])
> }
>
> static void
> -print_iso9660_recurse (iso9660_t *p_iso, const char psz_path[])
> +print_iso9660_recurse (iso9660_t *p_iso, const char psz_path[],
> + unsigned int rec_counter)
> {
> CdioList_t *entlist;
> CdioList_t *dirlist = _cdio_list_new ();
> @@ -234,6 +242,15 @@ print_iso9660_recurse (iso9660_t *p_iso, const char
> psz_path[])
> return;
> }
>
> + rec_counter++;
> + if (rec_counter > CDIO_MAX_DIR_RECURSION) {
> + free(translated_name);
> + free(dirlist);
> + _cdio_list_free (entlist, true);
> + report( stderr,
> + "Directory recursion too deep. ISO most probably damaged.\n"
> );
> + return;
> + }
> +
> /* Iterate over files in this directory */
>
> _CDIO_LIST_FOREACH (entnode, entlist)
> @@ -297,7 +315,7 @@ print_iso9660_recurse (iso9660_t *p_iso, const char
> psz_path[])
> {
> char *_fullname = _cdio_list_node_data (entnode);
>
> - print_iso9660_recurse (p_iso, _fullname);
> + print_iso9660_recurse (p_iso, _fullname, rec_counter);
> }
>
> _cdio_list_free (dirlist, true);
> @@ -306,7 +324,7 @@ print_iso9660_recurse (iso9660_t *p_iso, const char
> psz_path[])
> static void
> print_iso9660_fs (iso9660_t *iso)
> {
> - print_iso9660_recurse (iso, "/");
> + print_iso9660_recurse (iso, "/", 0);
> }
>
> static void
>
> -----------------------------------------------------------------------
>
> With this change, iso-info --no-joliet -f still floods the terminal
> with insane long paths "/a/0/0/0/..." but bails out with
> Directory recursion too deep. ISO most probably damaged.
> before valgrind can crash.
> ==11439== All heap blocks were freed -- no leaks are possible
> ...
> ==11439== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
>
>
> Have a nice day :)
>
> Thomas
>
>
>