{"action":"opened","issue":{"url":"https://api.github.com/repos/LibRaw/LibRaw/issues/171","repository_url":"https://api.github.com/repos/LibRaw/LibRaw","labels_url":"https://api.github.com/repos/LibRaw/LibRaw/issues/171/labels{/name}","comments_url":"https://api.github.com/repos/LibRaw/LibRaw/issues/171/comments","events_url":"https://api.github.com/repos/LibRaw/LibRaw/issues/171/events","html_url":"https://github.com/LibRaw/LibRaw/issues/171","id":339432755,"node_id":"MDU6SXNzdWUzMzk0MzI3NTU=","number":171,"title":"Negative integer overflow in memmgr leading to LIBRAW_UNSUFFICIENT_MEMORY","user":{"login":"dtomas","id":4202709,"node_id":"MDQ6VXNlcjQyMDI3MDk=","avatar_url":"https://avatars2.githubusercontent.com/u/4202709?v=4","gravatar_id":"","url":"https://api.github.com/users/dtomas","html_url":"https://github.com/dtomas","followers_url":"https://api.github.com/users/dtomas/followers","following_url":"https://api.github.com/users/dtomas/following{/other_user}","gists_url":"https://api.github.com/users/dtomas/gists{/gist_id}","starred_url":"https://api.github.com/users/dtomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtomas/subscriptions","organizations_url":"https://api.github.com/users/dtomas/orgs","repos_url":"https://api.github.com/users/dtomas/repos","events_url":"https://api.github.com/users/dtomas/events{/privacy}","received_events_url":"https://api.github.com/users/dtomas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-09T12:41:08Z","updated_at":"2018-07-09T12:41:08Z","closed_at":null,"author_association":"NONE","body":"When calling LibRaw::dcraw_process() (via the rawpy bindings), we consistently encountered LIBRAW_UNSUFFICIENT_MEMORY errors on our CI server, while it seemed to work on our development machines.\r\nWhen looking into it using gdb, we found that memmgr.alloc_cnt was decremented more often than incremented, causing it to overflow, leading to the aforementioned error in the next malloc() call.\r\nThe extra decrements all came from https://github.com/LibRaw/LibRaw/blob/4dbc1baf0acb967c78ab94ba2151fdef724ea4d0/internal/dcraw_common.cpp#L6432, which seemed to have been called in each thread spawned via OpenMP.\r\nThe issue can be worked around by setting the env variable OMP_NUM_THREADS=1."}}
{"actor":{"display_login":"dtomas"}}