Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Off-by-one error in binisstream #2

Closed
Malvineous opened this issue Nov 5, 2017 · 4 comments
Closed

Off-by-one error in binisstream #2

Malvineous opened this issue Nov 5, 2017 · 4 comments
Labels

Comments

@Malvineous
Copy link
Member

binisstream seems to report a value one too small in filesize(). See adplug/adplug#17

@Malvineous Malvineous added the bug label Nov 5, 2017
@mywave82
Copy link
Contributor

mywave82 commented Aug 5, 2019

A patch that partially fixes this issue is already merged, but also #8 is needed

@Malvineous
Copy link
Member Author

Fixed by #8

@sneakernets
Copy link

opencubicplayer is still insisting this isn't fixed. Per their configure script:

if test "x$with_adplug" != "xno"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking If libbinio used by AdPlug contains bugs https://github.com/adplug/libbinio/issues/2" >&5
$as_echo_n "checking If libbinio used by AdPlug contains bugs https://github.com/adplug/libbinio/issues/2... " >&6; }
        CXXFLAGS="$CXXFLAGS $ADPLUG_CXXFLAGS"
        LIBS="$LIBS $ADPLUG_LIBS"

        if test "$cross_compiling" = yes; then :
  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

#include <binio.h>
#include <binstr.h>
#include <cstdlib>
#include <string.h>
#include <adplug/adplug.h>
#include <adplug/fprovide.h>
#include <string.h>

int
main ()
{

        binisstream *f = new binisstream((void *)"foobar", 6);
        long size;
        char test[6] = {1,2,3,4,5,6};

        f->seek(0, binio::End);
        size = f->pos();
        f->seek(0);

        if (f->readString(test, size) != 6) return -1;

        /* test should contain "foobar" if all is correct */
        return memcmp(test, "foobar", 6);

  ;
  return 0;
}
_ACEOF
if ac_fn_cxx_try_run "$LINENO"; then :
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
$as_echo "ok" >&6; }
else
  as_fn_error $? "\"libbinio fails to use memoryobjects\"" "$LINENO" 5

fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

This test bombs out with the latest code in this git repo.

@Malvineous
Copy link
Member Author

@sneakernets Please open a new issue if there's still a problem, it makes it difficult to keep track of where we're at if we have to remember to go back to closed issues, especially ones that were resolved so long ago with so many code changes since.

@adplug adplug locked as resolved and limited conversation to collaborators Sep 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants