Skip to content

Instantly share code, notes, and snippets.

View Bhambya's full-sized avatar

Ganesh Bhambarkar Bhambya

View GitHub Profile
@Bhambya
Bhambya / reproduce_libtorrent_crash.cpp
Created May 14, 2026 16:28
Reproduce access to freed torrent in libtorrent
/*
Reproduction case for use-after-free crash in auto_manage_torrents.
The bug: after remove_torrent() is called (which calls abort() and unlinks
the torrent from all session lists), a previously-dispatched torrent_handle
operation (like set_flags with auto_managed) can re-add the torrent to
m_torrent_lists. Since the torrent is no longer in m_torrents (the owning
container), once the last shared_ptr is dropped the torrent is destroyed,
leaving a dangling pointer in m_torrent_lists. The next
@Bhambya
Bhambya / Scrollbar.kt
Created December 30, 2024 11:24 — forked from mxalbert1996/Scrollbar.kt
Modifiers to draw scrollbars in Jetpack Compose
/*
* MIT License
*
* Copyright (c) 2022 Albert Chang
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is