{"action":"created","issue":{"url":"https://api.github.com/repos/igraph/igraph/issues/1138","repository_url":"https://api.github.com/repos/igraph/igraph","labels_url":"https://api.github.com/repos/igraph/igraph/issues/1138/labels{/name}","comments_url":"https://api.github.com/repos/igraph/igraph/issues/1138/comments","events_url":"https://api.github.com/repos/igraph/igraph/issues/1138/events","html_url":"https://github.com/igraph/igraph/issues/1138","id":386457111,"node_id":"MDU6SXNzdWUzODY0NTcxMTE=","number":1138,"title":"Out-of-bounds access when calling barabasi_game with zero vertices","user":{"login":"szhorvat","id":1212871,"node_id":"MDQ6VXNlcjEyMTI4NzE=","avatar_url":"https://avatars3.githubusercontent.com/u/1212871?v=4","gravatar_id":"","url":"https://api.github.com/users/szhorvat","html_url":"https://github.com/szhorvat","followers_url":"https://api.github.com/users/szhorvat/followers","following_url":"https://api.github.com/users/szhorvat/following{/other_user}","gists_url":"https://api.github.com/users/szhorvat/gists{/gist_id}","starred_url":"https://api.github.com/users/szhorvat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szhorvat/subscriptions","organizations_url":"https://api.github.com/users/szhorvat/orgs","repos_url":"https://api.github.com/users/szhorvat/repos","events_url":"https://api.github.com/users/szhorvat/events{/privacy}","received_events_url":"https://api.github.com/users/szhorvat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-01T13:11:13Z","updated_at":"2018-12-01T22:16:47Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Caught when running the IGraph/M test suite with address sanitizer.\r\n\r\nPure C example to follow later.\r\n\r\n```\r\nIn[2]:= IGBarabasiAlbertGame[0,1]                                                                                                \r\n=================================================================\r\n==76895==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000b6c8 at pc 0x0001161a0af5 bp 0x7ffeec2fdbd0 sp 0x7ffeec2fdbc8\r\nREAD of size 8 at 0x60200000b6c8 thread T0\r\n    #0 0x1161a0af4 in igraph_psumtree_update igraph_psumtree.c:83\r\n    #1 0x11600a179 in igraph_i_barabasi_game_psumtree games.c:353\r\n    #2 0x11600abec in igraph_barabasi_game games.c:564\r\n    #3 0x115e513dc in IG::barabasiAlbertGame(long long, double, double, long long, mma::TensorRef<double>, bool, bool, long long) (IGraphM.dylib:x86_64+0x373dc)\r\n    #4 0x115e50f35 in IG_barabasiAlbertGame (IGraphM.dylib:x86_64+0x36f35)\r\n    #5 0x10978464d  (libWolframEngine.dylib:x86_64+0x2c564d)\r\n    ...\r\n\r\n0x60200000b6c8 is located 8 bytes to the left of 8-byte region [0x60200000b6d0,0x60200000b6d8)\r\nallocated by thread T0 here:\r\n    #0 0x103960497 in wrap_calloc (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x57497)\r\n    #1 0x1160eb24d in igraph_vector_init vector.pmt:128\r\n    #2 0x1161a0869 in igraph_psumtree_init igraph_psumtree.c:41\r\n    #3 0x116009f5c in igraph_i_barabasi_game_psumtree games.c:336\r\n    #4 0x11600abec in igraph_barabasi_game games.c:564\r\n    #5 0x115e513dc in IG::barabasiAlbertGame(long long, double, double, long long, mma::TensorRef<double>, bool, bool, long long) (IGraphM.dylib:x86_64+0x373dc)\r\n    #6 0x115e50f35 in IG_barabasiAlbertGame (IGraphM.dylib:x86_64+0x36f35)\r\n    #7 0x10978464d  (libWolframEngine.dylib:x86_64+0x2c564d)\r\n    ...\r\n\r\nSUMMARY: AddressSanitizer: heap-buffer-overflow igraph_psumtree.c:83 in igraph_psumtree_update\r\nShadow bytes around the buggy address:\r\n  0x1c0400001680: fa fa 00 fa fa fa fd fa fa fa 00 04 fa fa 00 fa\r\n  0x1c0400001690: fa fa fd fa fa fa 00 04 fa fa 00 fa fa fa fd fa\r\n  0x1c04000016a0: fa fa 00 04 fa fa 00 fa fa fa 01 fa fa fa fd fd\r\n  0x1c04000016b0: fa fa fd fa fa fa fd fd fa fa 00 fa fa fa fd fa\r\n  0x1c04000016c0: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa\r\n=>0x1c04000016d0: fa fa fd fa fa fa 00 fa fa[fa]00 fa fa fa 00 fa\r\n  0x1c04000016e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa\r\n  0x1c04000016f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa\r\n  0x1c0400001700: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa\r\n  0x1c0400001710: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa\r\n  0x1c0400001720: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa\r\nShadow byte legend (one shadow byte represents 8 application bytes):\r\n  Addressable:           00\r\n  Partially addressable: 01 02 03 04 05 06 07 \r\n  Heap left redzone:       fa\r\n  Freed heap region:       fd\r\n  Stack left redzone:      f1\r\n  Stack mid redzone:       f2\r\n  Stack right redzone:     f3\r\n  Stack after return:      f5\r\n  Stack use after scope:   f8\r\n  Global redzone:          f9\r\n  Global init order:       f6\r\n  Poisoned by user:        f7\r\n  Container overflow:      fc\r\n  Array cookie:            ac\r\n  Intra object redzone:    bb\r\n  ASan internal:           fe\r\n  Left alloca redzone:     ca\r\n  Right alloca redzone:    cb\r\n\r\nOut[2]= Graph[<0>, <0>]\r\n\r\nIn[3]:= Options[IGBarabasiAlbertGame]                                                                                            \r\n\r\nOut[3]= {DirectedEdges -> True, TotalDegreeAttraction -> False, Method -> PSumTree, StartingGraph -> None}\r\n\r\nIn[4]:=         \r\n```                                                                                                                 "},"comment":{"url":"https://api.github.com/repos/igraph/igraph/issues/comments/443462837","html_url":"https://github.com/igraph/igraph/issues/1138#issuecomment-443462837","issue_url":"https://api.github.com/repos/igraph/igraph/issues/1138","id":443462837,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MzQ2MjgzNw==","user":{"login":"ntamas","id":195637,"node_id":"MDQ6VXNlcjE5NTYzNw==","avatar_url":"https://avatars2.githubusercontent.com/u/195637?v=4","gravatar_id":"","url":"https://api.github.com/users/ntamas","html_url":"https://github.com/ntamas","followers_url":"https://api.github.com/users/ntamas/followers","following_url":"https://api.github.com/users/ntamas/following{/other_user}","gists_url":"https://api.github.com/users/ntamas/gists{/gist_id}","starred_url":"https://api.github.com/users/ntamas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntamas/subscriptions","organizations_url":"https://api.github.com/users/ntamas/orgs","repos_url":"https://api.github.com/users/ntamas/repos","events_url":"https://api.github.com/users/ntamas/events{/privacy}","received_events_url":"https://api.github.com/users/ntamas/received_events","type":"User","site_admin":false},"created_at":"2018-12-01T22:16:47Z","updated_at":"2018-12-01T22:16:47Z","author_association":"MEMBER","body":"Hmm, what shall we do when the user passes `n=0` and `m>0`? Shall we create a graph with `m` loop edges, or shall we simply throw an error?"}}
{"actor":{"display_login":"ntamas"}}