On 2015-04-06 22:33:28, Celelibi wrote: > Package: yafc > Version: 1.3.5-2 > Severity: important > Tags: upstream patch > > Dear maintainer, > > There is a bug in the path shortener that makes yafc crash on some > specific input. > > When it tries to replace a short directory name with "..." it tries to > push the remaining of the string farther away, without reallocating a > larger buffer. > > For instance: > /w/some/very/long/pathname/whichis/really/too/long/andshouldbeshortened.html > is likely to cause the bug. > > The actual bug is in src/libmhe/shortpath.c when using strpush. > > I propose here a patch that simplifies the path shortening code so that > it has no loop, no complex condition, no temporary memory allocation, no > complex string handling. > > In short: half the size, twice the fun. :) > > The patch hasn't been extensively tested, but I guess it should be > bug-free and behave like the original code.
The behavior of the new code differs from the old code. Previously, "averylongdirectoryname/filename.extension" was shortened to "...me/filename.extension". The new code returns "averylongdirectoryname/...t". Also, "/usr/bin/averylongfilenamethatistoolongindeed.tar.gz = ...stoolongindeed.tar.gz" was shortened to "...stoolongindeed.tar.gz" and now it's "/...stoolongindeed.tar.gz". If you can fix these issues, I'm happy to apply the patch. Cheers -- Sebastian Ramacher
signature.asc
Description: Digital signature

