Ondřej Vašík wrote: > Hello, > as reported in https://bugzilla.redhat.com/show_bug.cgi?id=502026, in dd > is an unnecessary memory allocation for input block even if input block > buffer is not needed (skip and count set to 0). Attached patch should > prevent memory exhaustion error in that very special case. I guess > mentioning in NEWS is not required in that case...
> diff --git a/src/dd.c b/src/dd.c > index 3ba616b..be6d544 100644 > --- a/src/dd.c > +++ b/src/dd.c > @@ -1553,6 +1553,10 @@ dd_copy (void) > int exit_status = EXIT_SUCCESS; > size_t n_bytes_read; > > + /* Do not unnecessarily allocate memory */ > + if (max_records == 0 && skip_records == 0) > + return exit_status; So that would not run skip(STDOUT_FILENO,...) if count==0. Would this break existing scripts that for example used this command to position a non seekable device? dd count=0 of=/dev/tape seek=1234 cheers, Pádraig. _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
