Coder Social home page Coder Social logo

Comments (9)

fadden avatar fadden commented on August 11, 2024 1

I can reproduce the problem:

**412225** new/new[] failed and should throw an exception, but Valgrind
**412225**    cannot throw exceptions and so is aborting instead.  Sorry.
==412225==    at 0x483B3CC: ??? (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==412225==    by 0x483C5F5: operator new[](unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==412225==    by 0x1117E0: CopyFiles(DiskImgLib::DiskFS*, int, char**) (MakeDisk.cpp:153)
==412225==    by 0x111B81: Process(char const*, char const*, char const*, int, char**) (MakeDisk.cpp:303)
==412225==    by 0x11136B: main (MakeDisk.cpp:376)****

The issue occurs if you try to add a directory file, which ftell claims has a length of 0x7FFFFFFFFFFFFFFF. new[] throws an exception, which MakeDisk doesn't handle.

The workaround is to use something like "find . -type f" to only find normal files. The proper fix is to have MakeDisk ignore directories. The simple fix is to add a 2GB file size test, which ought to be there anyway:

diff --git a/linux/MakeDisk.cpp b/linux/MakeDisk.cpp
index 38cb505..64c5af5 100644
--- a/linux/MakeDisk.cpp
+++ b/linux/MakeDisk.cpp
@@ -148,6 +148,12 @@ CopyFiles(DiskFS* pDiskFS, int argc, char** argv)
         }
 
         len = ftell(fp);
+        if (len >= 1L<<31) {    // 2GB
+            fprintf(stderr, "Warning: file '%s' too large, skipping\n", *argv);
+            fclose(fp);
+            argv++;
+            continue;
+        }
         rewind(fp);
 
         buf = new char[len];

It's a hack, but MakeDisk is about 70% hack, so I'm not too worried. :-)

from ciderpress.

Zombie-Ryushu avatar Zombie-Ryushu commented on August 11, 2024 1

Yes I am. I build RPMs and DEBs. It's more consistent if I am not publishing as many downstream Patches.

from ciderpress.

Zombie-Ryushu avatar Zombie-Ryushu commented on August 11, 2024

I am referring down multiple directories with a wildcard, using the makedisk utility.

from ciderpress.

Zombie-Ryushu avatar Zombie-Ryushu commented on August 11, 2024

I am referring down multiple directories with a wildcard, using the makedisk utility.
The makedisk tool does not crash every time, only if the recursion of files are used.

from ciderpress.

fadden avatar fadden commented on August 11, 2024

I added an explicit test for "is it a regular file", as well as the length check.

from ciderpress.

Zombie-Ryushu avatar Zombie-Ryushu commented on August 11, 2024

Cann a micro-release be produced to fix this bug?

from ciderpress.

fadden avatar fadden commented on August 11, 2024

Sure. This doesn't affect the Windows binary, so I don't need to make a new one of those. I take it you're downloading the tarball from the releases page?

from ciderpress.

neowinston avatar neowinston commented on August 11, 2024

Can I contribute somehow to make a diff?

from ciderpress.

fadden avatar fadden commented on August 11, 2024

https://github.com/fadden/ciderpress/releases/tag/v4.0.5-d1a

from ciderpress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.