Created attachment 151578 [details] Patch for fixing the md5 infinite loop read(2) can return 0 if an EOF is encountered. The problem is that the loop in MDXFileChunk doesn't account for this, so any callers of the API can encounter an infinite loop on EOF (which includes md5). The attached patch addresses this issue. Sponsored by: EMC / Isilon Storage Division
CCing potentially interested stakeholders.
A commit references this bug: Author: ngie Date: Fri Apr 24 11:03:48 UTC 2015 New revision: 281928 URL: https://svnweb.freebsd.org/changeset/base/281928 Log: Avoid an infinite loop by ensuring that the amount of bytes read is greater than 0 in MDXFileChunk when calculating the checksum This edgecase can be triggered if the file is truncated while the checksum is being calculated (i.e. the EOF is reached) Differential Revision: https://reviews.freebsd.org/D2351 (patch by darius) PR: 196694 Reviewed by: delphij, ngie Submitted by: Daniel O'Connor <darius@dons.net.au> Sponsored by: EMC / Isilon Storage Division Changes: head/lib/libmd/mdXhl.c
A commit references this bug: Author: ngie Date: Mon May 18 10:45:19 UTC 2015 New revision: 283054 URL: https://svnweb.freebsd.org/changeset/base/283054 Log: MFC r281928: Avoid an infinite loop by ensuring that the amount of bytes read is greater than 0 in MDXFileChunk when calculating the checksum This edgecase can be triggered if the file is truncated while the checksum is being calculated (i.e. the EOF is reached) Differential Revision: https://reviews.freebsd.org/D2351 (patch by darius) PR: 196694 Reviewed by: delphij, ngie Submitted by: Daniel O'Connor <darius@dons.net.au> Sponsored by: EMC / Isilon Storage Division Changes: _U stable/10/ stable/10/lib/libmd/mdXhl.c
A commit references this bug: Author: ngie Date: Mon May 18 10:46:52 UTC 2015 New revision: 283055 URL: https://svnweb.freebsd.org/changeset/base/283055 Log: MFstable/10 r283054: MFC r281928: Avoid an infinite loop by ensuring that the amount of bytes read is greater than 0 in MDXFileChunk when calculating the checksum This edgecase can be triggered if the file is truncated while the checksum is being calculated (i.e. the EOF is reached) Differential Revision: https://reviews.freebsd.org/D2351 (patch by darius) PR: 196694 Reviewed by: delphij, ngie Submitted by: Daniel O'Connor <darius@dons.net.au> Sponsored by: EMC / Isilon Storage Division Changes: _U stable/9/ _U stable/9/lib/ stable/9/lib/libmd/mdXhl.c