Thanks to visit codestin.com
Credit goes to github.com

Skip to content

git_blob_create_frombuffer asserts with a mempack backend #4591

@jacquesg

Description

@jacquesg

Reproduction steps

  • Add a mempack backend
  • Call git_blob_create_frombuffer

Here's a stack trace

(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff707cf5d in __GI_abort () at abort.c:90
#2  0x00007ffff7072f17 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x7ffff6517670 "stream->written + len > stream->size", file=file@entry=0x7ffff651740c "deps/libgit2/src/odb.c", 
    line=line@entry=372, function=function@entry=0x7ffff6517910 <__PRETTY_FUNCTION__.12340> "fake_wstream__write") at assert.c:92
#3  0x00007ffff7072fc2 in __GI___assert_fail (assertion=assertion@entry=0x7ffff6517670 "stream->written + len > stream->size", file=file@entry=0x7ffff651740c "deps/libgit2/src/odb.c", line=line@entry=372, 
    function=function@entry=0x7ffff6517910 <__PRETTY_FUNCTION__.12340> "fake_wstream__write") at assert.c:101
#4  0x00007ffff64ab5ff in fake_wstream__write (_stream=0x555555a0d700, data=<optimized out>, len=<optimized out>) at deps/libgit2/src/odb.c:372
#5  0x00007ffff64651fc in git_blob_create_frombuffer (id=id@entry=0x7fffffffd970, repo=<optimized out>, buffer=buffer@entry=0x555555983840, len=len@entry=5) at deps/libgit2/src/blob.c:66
#6  0x00007ffff6495d39 in git_index_add_frombuffer (index=index@entry=0x555555a0cfb0, source_entry=source_entry@entry=0x7fffffffd9e0, buffer=0x555555983840, len=5) at deps/libgit2/src/index.c:1434
#7  0x00007ffff6436fdd in XS_Git__Raw__Index_add_frombuffer (my_perl=<optimized out>, cv=<optimized out>) at ./xs/Index.xs:72
#8  0x000055555562f6a1 in Perl_pp_entersub ()
#9  0x00005555556274c6 in Perl_runops_standard ()
#10 0x00005555555a8827 in perl_run ()
#11 0x000055555557fe32 in main ()
(gdb) 

Expected behavior

No assertion :)

Actual behavior

An assertion is triggered.

Version of libgit2 (release number or SHA1)

d11c4a1

Operating system(s) tested

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions