Skip to content

Send custom headers with segment downloads - #25

Merged
peak3d merged 7 commits into
xbmc:masterfrom
glennguy:headers
May 12, 2017
Merged

peak3d merged 7 commits into
xbmc:masterfrom
glennguy:headers

Conversation

@glennguy

Copy link
Copy Markdown
Contributor

Hi @peak3d

This fixes #20. I'm very new to c++ so I don't know if this implementation is a good way of going about it particularly because it relies on a global variable, but it works nonetheless.

Comment thread src/main.cpp Outdated

ADDON::CHelper_libXBMC_addon *xbmc = 0;
std::uint16_t kodiDisplayWidth(0), kodiDisplayHeight(0);
std::string pipe;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me it feels wrong to use header fields from manifest requestl for the underlying stream files.
Its great that it works for the example in issue #20, but there could be some other constellations in the future.

Additional Headers should be passed using a new listItem property and has to be kept in session or adaptive_tree_ instance. They should then be passed to AdaptvieStream::download as a parameter value.

Beside this singletons on global scope (pipe) are not longer supported in future binary addons because multiple instances of the addon can be opened (pls. see agile branch)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing. I've slowly managed to figure it out - I've got it to take the info from the listitem property, store in the session, pass the info to the adaptivetree_ instance so it can be passed to the download function in main.

Working now on how to parse the curl options string

@matthuisman

matthuisman commented Apr 27, 2017 •

Copy link
Copy Markdown
Contributor

Something like this?
master...matthuisman:master

(that is forked from agile)

I don't know how to compile the addons so it's really just to maybe help out @glennguy
There is probably some type-o's etc.

But is that what you had in mind @peak3d ?

I'm still not sure what is best name for all the variables.
It could be more than just headers - it's more like extra Curl parameters...

@peak3d

peak3d commented Apr 28, 2017 •

Copy link
Copy Markdown
Contributor

@matthuisman yes, exactly this way, there are no kodi changes needed as you already fugured out.
I'll look closer at it today.

Edit: naming: I'm working internally with CURLOPTIONS (and not with the URL | headers convention) because the | convention could be removed in the future)
https://github.com/peak3d/inputstream.adaptive/blob/master/src/main.cpp#L62

From naming I would suppose something wich reflects this: inputstream.adaptive.segment_curl_option_header)

I know its long name, but its at least readable.

@matthuisman

matthuisman commented Apr 29, 2017 •

Copy link
Copy Markdown
Contributor

@peak3d
Do you think maybe KodiAdaptiveStream::download could be changed to just accept a URL & a map of headers.

bool KodiAdaptiveStream::download(const char* url, std::map<string, string> &headers)

The range header and segment_curl_option_headers could be set in the AdaptiveStream::download_segment() function.

Is there an existing method that takes a curl header string and converts to a map?
eg. "Content-Type=application%2Fx-www-form-urlencoded%2FX-Forwarded-For=202.89.4.222"
and returns {'Content-Type': 'application/x-www-form-urlencoded', 'X-Forwarded-For':202.89.4.222}

If we don't want to append the string to the URL and let KODI handle it - then I guess we need a way of parsing it our-self?

Unless curl add-header can accept that string of multiple headers?

My initial idea was allowing multiple headers to be added using the & to separate them (like the | method).
Therefore, the name would be inputstream.adaptive.segment_curl_option_headers ?

@glennguy

Copy link
Copy Markdown
Contributor Author

My initial idea was allowing multiple headers to be added using the & to separate them (like the | method)

@peak3d Should we just have a string of header options that are delimited by '&' and the header values url encoded, just like kodi accepts after the pipe?

Also, should there be a 'pre-approved' list of headers eg. as there is in the Kodi source here and here?

@peak3d

peak3d commented Apr 30, 2017 •

Copy link
Copy Markdown
Contributor

@glennguy yes, pass headers somehow separated through the new listitem property, pass the string at initialization time to the AdaptiveTree. AdaptiveStream has access to the AdaptiveTree and can pass it as string (const std::string &) to the download override methode.

In download you have to split (there is a split function in helpers.h/cpp) and loop over the list and call CURL_AddOption (making another split for key value there).

Depending if you want to solve it by yourself or not, I have a little time tomorrow and can put it in if you want.

Edit: for sure you can create a std::vector<std::pair> once and pass it around, I would avoid a std::map because std:map has an overhad not needed here (sorted key access tree). I use std::map only if I need an access with an key value (map[key]) what is not needed here, we only want to iterate over the headers.

@glennguy

glennguy commented May 1, 2017

Copy link
Copy Markdown
Contributor Author

@peak3d Thanks for the help, I think I should be able to solve it now. I'll push some changes, later today hopefully.

@glennguy

glennguy commented May 1, 2017

Copy link
Copy Markdown
Contributor Author

@peak3d @matthuisman Changes made - tested with the following .strm file:

#KODIPROP:inputstreamaddon=inputstream.adaptive
#KODIPROP:inputstream.adaptive.manifest_type=mpd
#KODIPROP:inputstream.adaptive.segment_curl_option_headers=X-Forwarded-For=202.89.4.222&User-Agent=Mozilla/5.0%20%28X11%3B%20Ubuntu%3B%20Linux%20x86_64%3B%20rv%3A53.0%29%20Gecko/20100101%20Firefox/53.0
#KODIPROP:inputstream.adaptive.license_type=com.widevine.alpha
#KODIPROP:inputstream.adaptive.license_key=https://wvlic.brightcove.com/proxy/5375730767001|Content-Type=application%2Fx-www-form-urlencoded&X-Forwarded-For=202.89.4.222|A{SSM}|
http://dashtvnz-a.akamaihd.net/963482467001/963482467001_5375755467001_5375730767001.mpd?pubId=963482467001&videoId=5375730767001|X-Forwarded-For=202.89.4.222

I followed the example in wvdecrypter.cpp which made it quite easy in the end.

Comment thread src/main.cpp Outdated
xbmc->CURLAddOption(file, XFILE::CURL_OPTION_PROTOCOL, "acceptencoding", "gzip, deflate");
if (strcmp(segmentHeaders, "") != 0)
{
std::vector<std::string> header, headers = split(segmentHeaders, '&');

@matthuisman matthuisman May 1, 2017 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the string is encoded.. would you not be splitting on %26?

Maybe best to decode the entire string before this first split?
This would cover both the use of & or %26

Added benifit of not needing the decode in the for loop

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. '&' is used as a delimiter to separate the keys. The values are what is encoded.

CurlAddOption seems to take care of the decoding itself. The convention in the above example I posted is the same as what Kodi requires after the pipe from add-ons.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. OK.
Sorry, i thought it was following the pipe convention (whole string URL encoded)

Comment thread src/main.cpp Outdated
, license_key_(strLicKey)
, license_type_(strLicType)
, license_data_(strLicData)
, segment_headers_(strSegmentHeaders)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to set the variable segment_headers_ at all? (It's not actually used anywhere.)

Could we not just pass strSegmentHeaders direct to adaptiveTree?
adaptiveTree_->segment_headers_ = strSegmentHeaders;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right you are. Removed.

@matthuisman

matthuisman commented May 1, 2017 •

Copy link
Copy Markdown
Contributor

Still seems a bit odd having to define the same headers 3x times...

@peak3d
Are you sure we couldn't maybe swap it to a inputstream.adaptive.stream_headers (or session_headers)
And it applies to the "whole" inputstream session (every curl call for that stream- Key, MPD, Segments).
So, no longer required on the the stream URL, or key URL.

Individual specific headers could still be used by the pipe method on the key (eg. form encoded) / mpd if needed.

#KODIPROP:inputstreamaddon=inputstream.adaptive
#KODIPROP:inputstream.adaptive.manifest_type=mpd
#KODIPROP:inputstream.adaptive.stream_headers=X-Forwarded-For=202.89.4.222&User-Agent=Mozilla/5.0%20%28X11%3B%20Ubuntu%3B%20Linux%20x86_64%3B%20rv%3A53.0%29%20Gecko/20100101%20Firefox/53.0
#KODIPROP:inputstream.adaptive.license_type=com.widevine.alpha
#KODIPROP:inputstream.adaptive.license_key=https://wvlic.brightcove.com/proxy/5375730767001|Content-Type=application%2Fx-www-form-urlencoded|A{SSM}|
http://dashtvnz-a.akamaihd.net/963482467001/963482467001_5375755467001_5375730767001.mpd?pubId=963482467001&videoId=5375730767001

@JinRonin

JinRonin commented May 1, 2017

Copy link
Copy Markdown

the motivation to allow custom headers should not be to bypass geo restrictions...

@matthuisman

Copy link
Copy Markdown
Contributor

@JinRonin
Your right. However, there may be other good uses - eg: a required User-agent header.

@glennguy

glennguy commented May 2, 2017

Copy link
Copy Markdown
Contributor Author

@JinRonin up until recently Netflix has filtered certain User-Agent headers. Seeing that large amount of work that has recently gone into adding support to play Netflix content, and once the kodi-agile fork is merged and Kodi 18 is released the assumed following large amount of users taking advantage of it, there's a high likelihood that that Kodi User-Agent headers will be filtered on Netflix's end.

The stream file posted by @matthuisman in issue #20 has merely been a convenient way to test the implementation of this feature. I don't believe there has been any explicit or implicit statement at least from myself that the motivation behind this PR has been to bypass geoblocking.

@matthuisman

Copy link
Copy Markdown
Contributor

I often find users who are in the correct country but use a VPN.
Therefore their IPs will be shown as another country.
By them setting the X-Forward-For header to their actual IP, they may be able to view the content for their actual country.

@matthuisman

Copy link
Copy Markdown
Contributor

Off-topic.
But does anyone else get Github notifications really late?
Mine seem to come in 24-48 hours after the actual activity.

@peak3d

peak3d commented May 3, 2017

Copy link
Copy Markdown
Contributor

I'll look today over the changes, sry for late response...

@peak3d

peak3d commented May 3, 2017 •

Copy link
Copy Markdown
Contributor

Are you sure we couldn't maybe swap it to a inputstream.adaptive.stream_headers (or session_headers)

@matthuisman: stream-key is already in the license_key template, therefore only manifest / media has to be decided.

Ok, lets start with an general Header key, wich is valid for both manifest + media (not license_key!!)
If we / you need a different control for headers between manifest and media, we'll define new keys for them wich overrides the general headers described above.

But pls. transport the header keys as bespoken from session -> tree -> download()

@matthuisman

matthuisman commented May 3, 2017 •

Copy link
Copy Markdown
Contributor

@peak3d

In the MPD download function, the URL might have headers in it (using |)
We would want these to over-ride any custom headers?

Therefore, we would need to set our custom headers before the URL is parsed.
I think we can do file.CURLAddOption before a file.CURLCreate.

DashTree and SmoothTree call download directly when getting the MPD file.
Feels strange editing these and adding stream_headers_ to their download call.

I suggest we have an override download function in AdapativeTree.cpp that accepts just a url and then calls download with the url and streamheaders?
That way, we don't need to modify the individual trees?

Here is some changes to look at (I haven't done the h files)
agile...matthuisman:agile

I also don't know how to compile the addons so it's just to maybe help out @glennguy :)

I also added our headers before parsing the URL in the other download function.
This is just so it matches and for some reason if there were | headers in the segment URL, they would over-write our headers.

Thoughts?

@peak3d

peak3d commented May 4, 2017

Copy link
Copy Markdown
Contributor

In the MPD download function, the URL might have headers in it (using |)
We would want these to over-ride any custom headers?

It was not expected that someone uses | for the mpd call, but for sure you are rugth, this is possible.
My opinion how we should proceed with the headers (on session initialization)

  • if stream_headers listitem key is given:
    a.) parse this key value into mpd_header pairs, make a copy (media_header)
    b.) remove the | separated part from mpd_url (mix is not supported)

  • if stream_headers listitem key is NOT given:
    a.) get the | separated header from mpd_url (if any) and parse it into mpd_header. media_header remains empty.

After that you have 2 parsed maps, one for tree, one for stream.
Pass those during the initialization to Tree and Stream so they can pass the header fields to download.

download then ONLY works with the extra passed headers, the | separated has been removed earlier.
IMO its always a good idea to choose one concept on a very early stage instead passing around multiple options.
After this change it should not feel strange to pass the "map" to the download function.

@glennguy

glennguy commented May 4, 2017

Copy link
Copy Markdown
Contributor Author

@peak3d sounds good, thanks. I'll get some changes made tonight.

@glennguy

glennguy commented May 5, 2017

Copy link
Copy Markdown
Contributor Author

@peak3d I think I've satisfied your comment above.

mpd_url is always stripped of pipe and anything following it.

If there is no stream_headers listitem set, then if there is pipe/headers then it is used for the manifest download only

If there is a stream_headers listitem, then it is used for both manifest and media.

I've left the headers in string format as it seemed a lot easier passing it around, and the parsing is done in the main/download functions.

@peak3d peak3d left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to be picky but there are some general principles wich should be respected:

  • write functions if something is dome multiple times
  • keep it simple / group similar things together
  • try to choose a readable workflow.

I know that especially the third point depends on the person who looks on it, but on the last end I'm the person who maintains the code and I have to understand things also if I haven't looked on things some months.

Comment thread src/common/AdaptiveStream.cpp Outdated

return download(strURL.c_str(), rangeHeader);
media_headers_ = tree_.media_headers_;
return download(strURL.c_str(), rangeHeader, media_headers_.c_str());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need 2 parameters to pass headers,
We should use a std::map to keep things simple (I know I was against it but here it makles sense)
media_header_['Range'] = rangeHeader? rangeHeader : "";

Comment thread src/common/AdaptiveTree.cpp Outdated
, download_speed_(0.0)
, average_download_speed_(0.0f)
, encryptionState_(ENCRYTIONSTATE_UNENCRYPTED)
, manifest_headers_("")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stl classes have their own constructor, no need to assign a value

Comment thread src/common/AdaptiveTree.h Outdated
bool has_timeshift_buffer_;

uint32_t bandwidth_;
std::string manifest_headers_, media_headers_;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

media_headers don't have to be in tree after the last duiscussion (separate headers for mpd / media)
should be std::map

Comment thread src/common/AdaptiveStream.h Outdated
const AdaptiveTree::Segment *current_seg_;
//We assume that a single segment can build complete frames
std::string segment_buffer_;
std::string media_headers_;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::map

Comment thread src/common/AdaptiveTree.h Outdated
const AdaptationSet *GetAdaptationSet(unsigned int pos) const { return current_period_ && pos < current_period_->adaptationSets_.size() ? current_period_->adaptationSets_[pos] : 0; };
protected:
virtual bool download(const char* url);
virtual bool download(const char* url, const char* manifestHeaders);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const std::map &

Comment thread src/main.cpp Outdated
@@ -219,6 +229,15 @@ bool KodiAdaptiveStream::download(const char* url, const char* rangeHeader)
xbmc->CURLAddOption(file, XFILE::CURL_OPTION_HEADER, "Range", rangeHeader);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

obsolete if Range is in headerMap

Comment thread src/main.cpp Outdated
}

adaptiveTree_->manifest_headers_ = strManifestHeaders;
adaptiveTree_->media_headers_ = strMediaHeaders;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

media_headers_ pls not in tree

media_heders should be passed to AdaptiveStream here:
https://github.com/peak3d/inputstream.adaptive/blob/agile/src/main.cpp#L1521

Comment thread src/main.cpp Outdated

const char *lt(""), *lk(""), *ld(""), *lsc("");
const char *lt(""), *lk(""), *ld(""), *lsc(""), *manh(""), *medh(""), *m_strURL;
m_strURL = props.m_strURL;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this an member? we don't need it permanent.
Should be local variable

Comment thread src/main.cpp Outdated
}
}

if (strcmp(manh, "") == 0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very confusing for me, after 5 times reading I still don't understand why need 3 strings for this task.

IMO this is the place where:

  • make a copy of props.m_strURL
  • look if | is in string, if so:
  • if inputstream.adaptive.stream_headers is not given, parse it into mahd
  • remove the | part from the copy.

Parsing of a string for header parts should be done in a function (parseheader(std::map, const char *)

Doing the parsing stuff should be only done once (here!!), having it in download() means that we parse the same stuff every segment again, this is not very resource friendly.

Comment thread src/main.cpp Outdated
xbmc->Log(ADDON::LOG_DEBUG, "Open()");

const char *lt(""), *lk(""), *ld(""), *lsc("");
const char *lt(""), *lk(""), *ld(""), *lsc(""), *manh(""), *medh(""), *m_strURL;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

manh / medh are std::map<std::string, std::string>

@glennguy

glennguy commented May 6, 2017

Copy link
Copy Markdown
Contributor Author

@peak3d Thank you so much for the feedback, not being picky at all. My apologies that it seems as I don't really know what I'm doing with regards to a lot of the changes, I'm very much a beginner (less than a month) at c++. I am keen to contribute but please say if it is unhelpful at my skill/experience level.

I think I've addressed the issues now. We're now using maps to pass the headers around, and there is a separate function in helpers.cpp to parse them.

@matthuisman

Copy link
Copy Markdown
Contributor

@glennguy @peak3d

Maybe it can drop down to a single download function in main.cpp now?

@peak3d

peak3d commented May 8, 2017

Copy link
Copy Markdown
Contributor

@glennguy way of programming is different from dev to dev, its like starting a friendship where each other has to figure out how the other one's character is. I really appreciate that you go the way with me, the future is important and the more people contribute the better.
Thanx for your patience!

Pls. leave 2 download methds so far as we do not know what's happening in the future.
My feeling is, that we will be happy to have them separated in the future.

I'll look over the changes today, keep head up :-)

@peak3d peak3d left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nearly done, great work! Only the 2 minor cosmetics and we're done!

Comment thread src/main.cpp Outdated
return false;
xbmc->CURLAddOption(file, XFILE::CURL_OPTION_PROTOCOL, "seekable", "0");
xbmc->CURLAddOption(file, XFILE::CURL_OPTION_PROTOCOL, "acceptencoding", "gzip");
if (!manifestHeaders.empty())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed to request for empty() here.

If you are lazy in writing you could also do:
for (const auto &entry : manifestHeaders)
{

Comment thread src/main.cpp Outdated
xbmc->CURLAddOption(file, XFILE::CURL_OPTION_HEADER, "Range", rangeHeader);
xbmc->CURLAddOption(file, XFILE::CURL_OPTION_HEADER, "Connection", "keep-alive");
xbmc->CURLAddOption(file, XFILE::CURL_OPTION_PROTOCOL, "acceptencoding", "gzip, deflate");
if (!mediaHeaders.empty())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls. see previous comment

@matthuisman

Copy link
Copy Markdown
Contributor

Great work guys!
Looking forward to this :)

I'm guessing this change will only be in KODI 18.0 builds as this is on agile branch?
(Not back-ported to current 17.1?)

@glennguy

Copy link
Copy Markdown
Contributor Author

@peak3d all sorted, and changed to 'lazy' for loop. Seems a lot easier to read that way. Thanks for your patience and spoon feeding me some of it, it has helped me learn a lot.

@matthuisman this PR is against the master branch so its for 17.1. I imagine it will get pulled into the agile branch but @peak3d will decide that. I see you mentioned you haven't got a build environment set up for this, let me know if you need some help - I can build for some platforms.

@peak3d
peak3d merged commit 7094e24 into xbmc:master May 12, 2017
@peak3d

peak3d commented May 12, 2017

Copy link
Copy Markdown
Contributor

Thanx @glennguy !

@priyavadan

Copy link
Copy Markdown

sorry for reviving an old thread, so do we just need to define the stream_headers and that will apply the headers to both media and mpd? I am trying out the X-Forwarded-For passed to the stream headers.

@glennguy
glennguy deleted the headers branch March 21, 2021 12:12
dobo90 added a commit to dobo90/inputstream.adaptive that referenced this pull request May 21, 2026
…deo) streams

* First patch is grabbed from upstream Bento4.
* Second and third are written by me.

Test stream: https://storage.videos.solomon.tech/streaming-playlists/hls/edfcff7a-a8e1-4326-a2e7-424411aa189f/eaaa4f76-eef4-443e-821c-a34c36c15351-master.m3u8

Address sanitizer reports:

1)
```
Direct leak of 2480 byte(s) in 62 object(s) allocated from:
    #0 0x7f61f712d341 in operator new(unsigned long) (/usr/lib/libasan.so+0x12d341) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7b61a2b33313 in AP4_LinearReader::Advance(bool) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:461
    xbmc#2 0x7b61a2b33709 in AP4_LinearReader::ReadNextSample(unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:540
    xbmc#3 0x7b61a2a41871 in CLinearReader::ExecReadNextSample(CLinearReaderCB*, unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:680
    xbmc#4 0x7b61a2a3beb2 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:158
    xbmc#5 0x7b61a2819586 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#6 0x7b61a2818c4c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#7 0x7b61a2818872 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#8 0x7b61a2818011 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#9 0x7b61a2817c50 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#10 0x7b61a2817889 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#11 0x7b61a28169c9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#12 0x7b61a2818d6b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#13 0x7b61a281891f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#14 0x7b61a28181f4 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#15 0x7b61a2817ccc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#16 0x55873e2f7655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#17 0x7f61f409d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#18 0x7f61f409d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#19 0x7b61a27ff278 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#20 0x7b61a27ff278 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#21 0x7b61a27f5d0f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#22 0x7b61a2816b22 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#23 0x7b61a2802d63 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#24 0x7b61a27fba73 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba73) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#25 0x7b61a2813811 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#26 0x7b61a2812f53 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f53) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#27 0x7b61a2811bae in std::_Function_handler<void (), UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}>::_M_invoke(std::_Any_data const&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa11bae) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#28 0x7b61a2a8d1c1 in std::function<void ()>::operator()() const /usr/include/c++/16.1.1/bits/std_function.h:581
    xbmc#29 0x7b61a2a8c4bb in UTILS::THREAD::ThreadPool::Executor::Run() /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:70
    xbmc#30 0x7b61a2a8f5ca in void std::__invoke_impl<void, void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(std::__invoke_memfun_deref, void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:76
```

2)
```
Indirect leak of 1631788 byte(s) in 62 object(s) allocated from:
    #0 0x7f61f712d4d1 in operator new[](unsigned long) (/usr/lib/libasan.so+0x12d4d1) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7b61a2b28288 in AP4_DataBuffer::ReallocateBuffer(unsigned int) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4DataBuffer.cpp:210
    xbmc#2 0x7b61a2b2813d in AP4_DataBuffer::SetDataSize(unsigned int) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4DataBuffer.cpp:151
    xbmc#3 0x7b61a2b4f537 in AP4_Sample::ReadData(AP4_DataBuffer&, unsigned int, unsigned int) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4Sample.cpp:156
    xbmc#4 0x7b61a2b4f469 in AP4_Sample::ReadData(AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4Sample.cpp:127
    xbmc#5 0x7b61a2b333b1 in AP4_LinearReader::Advance(bool) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:467
    xbmc#6 0x7b61a2b33709 in AP4_LinearReader::ReadNextSample(unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:540
    xbmc#7 0x7b61a2a41871 in CLinearReader::ExecReadNextSample(CLinearReaderCB*, unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:680
    xbmc#8 0x7b61a2a3beb2 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:158
    xbmc#9 0x7b61a2819586 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#10 0x7b61a2818c4c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#11 0x7b61a2818872 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#12 0x7b61a2818011 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#13 0x7b61a2817c50 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#14 0x7b61a2817889 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#15 0x7b61a28169c9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#16 0x7b61a2818d6b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#17 0x7b61a281891f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#18 0x7b61a28181f4 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#19 0x7b61a2817ccc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#20 0x55873e2f7655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#21 0x7f61f409d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#22 0x7f61f409d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#23 0x7b61a27ff278 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#24 0x7b61a27ff278 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#25 0x7b61a27f5d0f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#26 0x7b61a2816b22 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#27 0x7b61a2802d63 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#28 0x7b61a27fba73 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba73) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#29 0x7b61a2813811 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#30 0x7b61a2812f53 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f53) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
```
dobo90 added a commit to dobo90/inputstream.adaptive that referenced this pull request Jun 8, 2026
Fixes following sanitizer report:
=================================================================
==219283==ERROR: AddressSanitizer: heap-use-after-free on address 0x7d0453ac2330 at pc 0x7be408843f2d bp 0x7be40277dbf0 sp 0x7be40277dbe0
READ of size 8 at 0x7d0453ac2330 thread T64
    #0 0x7be408843f2c in std::__shared_ptr<AP4_CencSampleDecrypter, (__gnu_cxx::_Lock_policy)2>::operator bool() const /usr/include/c++/16.1.1/bits/shared_ptr_base.h:1756
    #1 0x7be40883c045 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182
    xbmc#2 0x7be408619596 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#3 0x7be408618c5c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#4 0x7be408618882 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#5 0x7be408618021 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#6 0x7be408617c60 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#7 0x7be408617899 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#8 0x7be4086169d9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#9 0x7be408618d7b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#10 0x7be40861892f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#11 0x7be408618204 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#12 0x7be408617cdc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#13 0x55fb298d6655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe45929d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe45929d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x7be4085ff288 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#17 0x7be4085ff288 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#18 0x7be4085f5d1f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#19 0x7be408616b32 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#20 0x7be408602d73 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#21 0x7be4085fba83 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba83) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#22 0x7be408613821 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#23 0x7be408612f63 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f63) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#24 0x7be408611bbe in std::_Function_handler<void (), UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}>::_M_invoke(std::_Any_data const&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa11bbe) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#25 0x7be40888d1d1 in std::function<void ()>::operator()() const /usr/include/c++/16.1.1/bits/std_function.h:581
    xbmc#26 0x7be40888c4cb in UTILS::THREAD::ThreadPool::Executor::Run() /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:70
    xbmc#27 0x7be40888f5da in void std::__invoke_impl<void, void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(std::__invoke_memfun_deref, void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#28 0x7be40888f4c8 in std::__invoke_result<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>::type std::__invoke<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#29 0x7be40888f44a in void std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/include/c++/16.1.1/bits/std_thread.h:303
    xbmc#30 0x7be40888f403 in std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::operator()() /usr/include/c++/16.1.1/bits/std_thread.h:310
    xbmc#31 0x7be40888f3e7 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> > >::_M_run() /usr/include/c++/16.1.1/bits/std_thread.h:255
    xbmc#32 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#33 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#34 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#35 0x7fe45931d21b  (/usr/lib/libc.so.6+0x11d21b) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

0x7d0453ac2330 is located 240 bytes inside of 288-byte region [0x7d0453ac2240,0x7d0453ac2360)
freed by thread T57 here:
    #0 0x7fe45c12e4c1 in operator delete(void*, unsigned long) (/usr/lib/libasan.so+0x12e4c1) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be40883b3be in CFragmentedSampleReader::~CFragmentedSampleReader() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:62
    xbmc#2 0x7be40863ad02 in std::default_delete<ISampleReader>::operator()(ISampleReader*) const /usr/include/c++/16.1.1/bits/unique_ptr.h:92
    xbmc#3 0x7be4086be093 in std::__uniq_ptr_impl<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:204
    xbmc#4 0x7be4086bd915 in std::unique_ptr<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:511
    xbmc#5 0x7be4086bd1ec in SESSION::CStream::UnlinkStream() /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:114
    xbmc#6 0x7be4085ed98b in CInputStreamAdaptive::EnableStream(int, bool) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:157
    xbmc#7 0x7be4085f9f3f in kodi::addon::CInstanceInputStream::ADDON_EnableStream(AddonInstance_InputStream const*, int, bool) /usr/include/kodi/addon-instance/Inputstream.h:2006
    xbmc#8 0x55fb2953d0bd  (/usr/lib/kodi/kodi.bin+0xd6c0bd) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294ecf1f in CVideoPlayer::OnExit() (/usr/lib/kodi/kodi.bin+0xd1bf1f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb298da2f7 in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092f7) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#13 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#14 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

previously allocated by thread T57 here:
    #0 0x7fe45c12d341 in operator new(unsigned long) (/usr/lib/libasan.so+0x12d341) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be4088442da in std::__detail::_MakeUniq<CFragmentedSampleReader>::__single_object std::make_unique<CFragmentedSampleReader, std::shared_ptr<CLinearReader>&, AP4_Track*&>(std::shared_ptr<CLinearReader>&, AP4_Track*&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#2 0x7be40883d940 in CFragmentedSampleReader::CreateReaderByTrack() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:319
    xbmc#3 0x7be4086bcc85 in SESSION::CStream::LinkStream(std::shared_ptr<SESSION::CStream>, int) /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:78
    xbmc#4 0x7be4085edebf in CInputStreamAdaptive::OpenStream(int) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:285
    xbmc#5 0x7be4085fa046 in kodi::addon::CInstanceInputStream::ADDON_OpenStream(AddonInstance_InputStream const*, int) /usr/include/kodi/addon-instance/Inputstream.h:2012
    xbmc#6 0x55fb29468dac in CDVDDemuxClient::OpenStream(int) (/usr/lib/kodi/kodi.bin+0xc97dac) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb294f5589 in CVideoPlayer::OpenStream(CCurrentStream&, long, int, int, bool) (/usr/lib/kodi/kodi.bin+0xd24589) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb294e7b0a in CVideoPlayer::OpenDefaultStreams(bool) (/usr/lib/kodi/kodi.bin+0xd16b0a) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294e91f4 in CVideoPlayer::Prepare() (/usr/lib/kodi/kodi.bin+0xd181f4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294eab6c in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19b6c) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#14 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#15 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T64 created by T57 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x7be40888d038 in std::thread::thread<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*, void>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/std_thread.h:175
    xbmc#3 0x7be40888c27e in UTILS::THREAD::ThreadPool::Executor::Executor(UTILS::THREAD::ThreadPool&) /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:55
    xbmc#4 0x7be408602f94 in std::__detail::_MakeUniq<UTILS::THREAD::ThreadPool::Executor>::__single_object std::make_unique<UTILS::THREAD::ThreadPool::Executor, UTILS::THREAD::ThreadPool&>(UTILS::THREAD::ThreadPool&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#5 0x7be4085fbf72 in auto UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fbf72) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#6 0x7be4085fc3dc in ISampleReader::ReadSampleAsync() (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fc3dc) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#7 0x7be4085ef0b8 in CInputStreamAdaptive::DemuxRead() /home/dobo/kodi/inputstream.adaptive/src/main.cpp:381
    xbmc#8 0x7be4085fa449 in kodi::addon::CInstanceInputStream::ADDON_DemuxRead(AddonInstance_InputStream const*) /usr/include/kodi/addon-instance/Inputstream.h:2032
    xbmc#9 0x55fb294688a4 in CDVDDemuxClient::Read() (/usr/lib/kodi/kodi.bin+0xc978a4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294e869d in CVideoPlayer::ReadPacket(DemuxPacket*&, CDemuxStream*&) (/usr/lib/kodi/kodi.bin+0xd1769d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb294eae22 in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19e22) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#15 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#16 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T57 created by T0 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x55fb298da1a2  (/usr/lib/kodi/kodi.bin+0x11091a2) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#3 0x55fb294e3181 in CVideoPlayer::OpenFile(CFileItem const&, CPlayerOptions const&) (/usr/lib/kodi/kodi.bin+0xd12181) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#4 0x55fb29b5310d in CApplicationPlayer::OpenFile(CFileItem const&, CPlayerOptions const&, CPlayerCoreFactory const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, IPlayerCallback&) (/usr/lib/kodi/kodi.bin+0x138210d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#5 0x55fb29b347ca in CApplication::PlayFile(CFileItem, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (/usr/lib/kodi/kodi.bin+0x13637ca) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#6 0x55fb29d7ecd8 in KODI::PLAYLIST::CPlayListPlayer::Play(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool) (/usr/lib/kodi/kodi.bin+0x15adcd8) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb29d7f9ef in KODI::PLAYLIST::CPlayListPlayer::Play() (/usr/lib/kodi/kodi.bin+0x15ae9ef) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb29d8ae07 in KODI::PLAYLIST::CPlayListPlayer::OnApplicationMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x15b9e07) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb2994f9b5 in KODI::MESSAGING::CApplicationMessenger::ProcessMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x117e9b5) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb2994fb85 in KODI::MESSAGING::CApplicationMessenger::ProcessMessages() (/usr/lib/kodi/kodi.bin+0x117eb85) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb29b387dc in CApplication::Process() (/usr/lib/kodi/kodi.bin+0x13677dc) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb29b340cb in CApplication::Run() (/usr/lib/kodi/kodi.bin+0x13630cb) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb291ef38f in main (/usr/lib/kodi/kodi.bin+0xa1e38f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe459227740  (/usr/lib/libc.so.6+0x27740) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe459227878 in __libc_start_main (/usr/lib/libc.so.6+0x27878) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x55fb29250154 in _start (/usr/lib/kodi/kodi.bin+0xa7f154) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)

SUMMARY: AddressSanitizer: heap-use-after-free /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182 in CFragmentedSampleReader::ReadSample()
Shadow bytes around the buggy address:
  0x7d0453ac2080: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x7d0453ac2100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7d0453ac2180: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
  0x7d0453ac2200: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2280: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x7d0453ac2300: fd fd fd fd fd fd[fd]fd fd fd fd fd fa fa fa fa
  0x7d0453ac2380: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2400: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x7d0453ac2480: fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa
  0x7d0453ac2500: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==219283==ABORTING
dobo90 added a commit to dobo90/inputstream.adaptive that referenced this pull request Jun 8, 2026
…deo) streams

* First patch reverts faulty commit from Kodi fork which introduces
  leaks.
* Second patch is grabbed from upstream Bento4 (and correctly fixes
  issue that faulty commit was trying to fix).
* Third comes from axiomatic-systems/Bento4#1069.

Test stream: https://storage.videos.solomon.tech/streaming-playlists/hls/edfcff7a-a8e1-4326-a2e7-424411aa189f/eaaa4f76-eef4-443e-821c-a34c36c15351-master.m3u8

Address sanitizer reports:

1)
```
Direct leak of 2480 byte(s) in 62 object(s) allocated from:
    #0 0x7f61f712d341 in operator new(unsigned long) (/usr/lib/libasan.so+0x12d341) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7b61a2b33313 in AP4_LinearReader::Advance(bool) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:461
    xbmc#2 0x7b61a2b33709 in AP4_LinearReader::ReadNextSample(unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:540
    xbmc#3 0x7b61a2a41871 in CLinearReader::ExecReadNextSample(CLinearReaderCB*, unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:680
    xbmc#4 0x7b61a2a3beb2 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:158
    xbmc#5 0x7b61a2819586 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#6 0x7b61a2818c4c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#7 0x7b61a2818872 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#8 0x7b61a2818011 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#9 0x7b61a2817c50 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#10 0x7b61a2817889 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#11 0x7b61a28169c9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#12 0x7b61a2818d6b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#13 0x7b61a281891f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#14 0x7b61a28181f4 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#15 0x7b61a2817ccc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#16 0x55873e2f7655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#17 0x7f61f409d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#18 0x7f61f409d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#19 0x7b61a27ff278 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#20 0x7b61a27ff278 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#21 0x7b61a27f5d0f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#22 0x7b61a2816b22 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#23 0x7b61a2802d63 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#24 0x7b61a27fba73 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba73) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#25 0x7b61a2813811 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#26 0x7b61a2812f53 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f53) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#27 0x7b61a2811bae in std::_Function_handler<void (), UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}>::_M_invoke(std::_Any_data const&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa11bae) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#28 0x7b61a2a8d1c1 in std::function<void ()>::operator()() const /usr/include/c++/16.1.1/bits/std_function.h:581
    xbmc#29 0x7b61a2a8c4bb in UTILS::THREAD::ThreadPool::Executor::Run() /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:70
    xbmc#30 0x7b61a2a8f5ca in void std::__invoke_impl<void, void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(std::__invoke_memfun_deref, void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:76
```

2)
```
Indirect leak of 1631788 byte(s) in 62 object(s) allocated from:
    #0 0x7f61f712d4d1 in operator new[](unsigned long) (/usr/lib/libasan.so+0x12d4d1) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7b61a2b28288 in AP4_DataBuffer::ReallocateBuffer(unsigned int) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4DataBuffer.cpp:210
    xbmc#2 0x7b61a2b2813d in AP4_DataBuffer::SetDataSize(unsigned int) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4DataBuffer.cpp:151
    xbmc#3 0x7b61a2b4f537 in AP4_Sample::ReadData(AP4_DataBuffer&, unsigned int, unsigned int) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4Sample.cpp:156
    xbmc#4 0x7b61a2b4f469 in AP4_Sample::ReadData(AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4Sample.cpp:127
    xbmc#5 0x7b61a2b333b1 in AP4_LinearReader::Advance(bool) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:467
    xbmc#6 0x7b61a2b33709 in AP4_LinearReader::ReadNextSample(unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:540
    xbmc#7 0x7b61a2a41871 in CLinearReader::ExecReadNextSample(CLinearReaderCB*, unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:680
    xbmc#8 0x7b61a2a3beb2 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:158
    xbmc#9 0x7b61a2819586 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#10 0x7b61a2818c4c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#11 0x7b61a2818872 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#12 0x7b61a2818011 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#13 0x7b61a2817c50 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#14 0x7b61a2817889 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#15 0x7b61a28169c9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#16 0x7b61a2818d6b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#17 0x7b61a281891f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#18 0x7b61a28181f4 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#19 0x7b61a2817ccc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#20 0x55873e2f7655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#21 0x7f61f409d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#22 0x7f61f409d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#23 0x7b61a27ff278 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#24 0x7b61a27ff278 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#25 0x7b61a27f5d0f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#26 0x7b61a2816b22 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#27 0x7b61a2802d63 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#28 0x7b61a27fba73 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba73) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#29 0x7b61a2813811 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#30 0x7b61a2812f53 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f53) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
```
dobo90 added a commit to dobo90/inputstream.adaptive that referenced this pull request Jun 8, 2026
Fixes following sanitizer report:
=================================================================
==219283==ERROR: AddressSanitizer: heap-use-after-free on address 0x7d0453ac2330 at pc 0x7be408843f2d bp 0x7be40277dbf0 sp 0x7be40277dbe0
READ of size 8 at 0x7d0453ac2330 thread T64
    #0 0x7be408843f2c in std::__shared_ptr<AP4_CencSampleDecrypter, (__gnu_cxx::_Lock_policy)2>::operator bool() const /usr/include/c++/16.1.1/bits/shared_ptr_base.h:1756
    #1 0x7be40883c045 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182
    xbmc#2 0x7be408619596 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#3 0x7be408618c5c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#4 0x7be408618882 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#5 0x7be408618021 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#6 0x7be408617c60 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#7 0x7be408617899 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#8 0x7be4086169d9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#9 0x7be408618d7b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#10 0x7be40861892f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#11 0x7be408618204 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#12 0x7be408617cdc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#13 0x55fb298d6655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe45929d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe45929d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x7be4085ff288 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#17 0x7be4085ff288 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#18 0x7be4085f5d1f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#19 0x7be408616b32 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#20 0x7be408602d73 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#21 0x7be4085fba83 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba83) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#22 0x7be408613821 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#23 0x7be408612f63 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f63) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#24 0x7be408611bbe in std::_Function_handler<void (), UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}>::_M_invoke(std::_Any_data const&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa11bbe) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#25 0x7be40888d1d1 in std::function<void ()>::operator()() const /usr/include/c++/16.1.1/bits/std_function.h:581
    xbmc#26 0x7be40888c4cb in UTILS::THREAD::ThreadPool::Executor::Run() /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:70
    xbmc#27 0x7be40888f5da in void std::__invoke_impl<void, void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(std::__invoke_memfun_deref, void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#28 0x7be40888f4c8 in std::__invoke_result<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>::type std::__invoke<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#29 0x7be40888f44a in void std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/include/c++/16.1.1/bits/std_thread.h:303
    xbmc#30 0x7be40888f403 in std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::operator()() /usr/include/c++/16.1.1/bits/std_thread.h:310
    xbmc#31 0x7be40888f3e7 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> > >::_M_run() /usr/include/c++/16.1.1/bits/std_thread.h:255
    xbmc#32 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#33 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#34 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#35 0x7fe45931d21b  (/usr/lib/libc.so.6+0x11d21b) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

0x7d0453ac2330 is located 240 bytes inside of 288-byte region [0x7d0453ac2240,0x7d0453ac2360)
freed by thread T57 here:
    #0 0x7fe45c12e4c1 in operator delete(void*, unsigned long) (/usr/lib/libasan.so+0x12e4c1) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be40883b3be in CFragmentedSampleReader::~CFragmentedSampleReader() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:62
    xbmc#2 0x7be40863ad02 in std::default_delete<ISampleReader>::operator()(ISampleReader*) const /usr/include/c++/16.1.1/bits/unique_ptr.h:92
    xbmc#3 0x7be4086be093 in std::__uniq_ptr_impl<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:204
    xbmc#4 0x7be4086bd915 in std::unique_ptr<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:511
    xbmc#5 0x7be4086bd1ec in SESSION::CStream::UnlinkStream() /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:114
    xbmc#6 0x7be4085ed98b in CInputStreamAdaptive::EnableStream(int, bool) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:157
    xbmc#7 0x7be4085f9f3f in kodi::addon::CInstanceInputStream::ADDON_EnableStream(AddonInstance_InputStream const*, int, bool) /usr/include/kodi/addon-instance/Inputstream.h:2006
    xbmc#8 0x55fb2953d0bd  (/usr/lib/kodi/kodi.bin+0xd6c0bd) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294ecf1f in CVideoPlayer::OnExit() (/usr/lib/kodi/kodi.bin+0xd1bf1f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb298da2f7 in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092f7) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#13 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#14 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

previously allocated by thread T57 here:
    #0 0x7fe45c12d341 in operator new(unsigned long) (/usr/lib/libasan.so+0x12d341) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be4088442da in std::__detail::_MakeUniq<CFragmentedSampleReader>::__single_object std::make_unique<CFragmentedSampleReader, std::shared_ptr<CLinearReader>&, AP4_Track*&>(std::shared_ptr<CLinearReader>&, AP4_Track*&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#2 0x7be40883d940 in CFragmentedSampleReader::CreateReaderByTrack() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:319
    xbmc#3 0x7be4086bcc85 in SESSION::CStream::LinkStream(std::shared_ptr<SESSION::CStream>, int) /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:78
    xbmc#4 0x7be4085edebf in CInputStreamAdaptive::OpenStream(int) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:285
    xbmc#5 0x7be4085fa046 in kodi::addon::CInstanceInputStream::ADDON_OpenStream(AddonInstance_InputStream const*, int) /usr/include/kodi/addon-instance/Inputstream.h:2012
    xbmc#6 0x55fb29468dac in CDVDDemuxClient::OpenStream(int) (/usr/lib/kodi/kodi.bin+0xc97dac) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb294f5589 in CVideoPlayer::OpenStream(CCurrentStream&, long, int, int, bool) (/usr/lib/kodi/kodi.bin+0xd24589) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb294e7b0a in CVideoPlayer::OpenDefaultStreams(bool) (/usr/lib/kodi/kodi.bin+0xd16b0a) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294e91f4 in CVideoPlayer::Prepare() (/usr/lib/kodi/kodi.bin+0xd181f4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294eab6c in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19b6c) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#14 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#15 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T64 created by T57 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x7be40888d038 in std::thread::thread<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*, void>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/std_thread.h:175
    xbmc#3 0x7be40888c27e in UTILS::THREAD::ThreadPool::Executor::Executor(UTILS::THREAD::ThreadPool&) /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:55
    xbmc#4 0x7be408602f94 in std::__detail::_MakeUniq<UTILS::THREAD::ThreadPool::Executor>::__single_object std::make_unique<UTILS::THREAD::ThreadPool::Executor, UTILS::THREAD::ThreadPool&>(UTILS::THREAD::ThreadPool&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#5 0x7be4085fbf72 in auto UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fbf72) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#6 0x7be4085fc3dc in ISampleReader::ReadSampleAsync() (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fc3dc) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#7 0x7be4085ef0b8 in CInputStreamAdaptive::DemuxRead() /home/dobo/kodi/inputstream.adaptive/src/main.cpp:381
    xbmc#8 0x7be4085fa449 in kodi::addon::CInstanceInputStream::ADDON_DemuxRead(AddonInstance_InputStream const*) /usr/include/kodi/addon-instance/Inputstream.h:2032
    xbmc#9 0x55fb294688a4 in CDVDDemuxClient::Read() (/usr/lib/kodi/kodi.bin+0xc978a4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294e869d in CVideoPlayer::ReadPacket(DemuxPacket*&, CDemuxStream*&) (/usr/lib/kodi/kodi.bin+0xd1769d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb294eae22 in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19e22) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#15 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#16 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T57 created by T0 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x55fb298da1a2  (/usr/lib/kodi/kodi.bin+0x11091a2) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#3 0x55fb294e3181 in CVideoPlayer::OpenFile(CFileItem const&, CPlayerOptions const&) (/usr/lib/kodi/kodi.bin+0xd12181) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#4 0x55fb29b5310d in CApplicationPlayer::OpenFile(CFileItem const&, CPlayerOptions const&, CPlayerCoreFactory const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, IPlayerCallback&) (/usr/lib/kodi/kodi.bin+0x138210d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#5 0x55fb29b347ca in CApplication::PlayFile(CFileItem, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (/usr/lib/kodi/kodi.bin+0x13637ca) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#6 0x55fb29d7ecd8 in KODI::PLAYLIST::CPlayListPlayer::Play(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool) (/usr/lib/kodi/kodi.bin+0x15adcd8) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb29d7f9ef in KODI::PLAYLIST::CPlayListPlayer::Play() (/usr/lib/kodi/kodi.bin+0x15ae9ef) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb29d8ae07 in KODI::PLAYLIST::CPlayListPlayer::OnApplicationMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x15b9e07) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb2994f9b5 in KODI::MESSAGING::CApplicationMessenger::ProcessMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x117e9b5) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb2994fb85 in KODI::MESSAGING::CApplicationMessenger::ProcessMessages() (/usr/lib/kodi/kodi.bin+0x117eb85) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb29b387dc in CApplication::Process() (/usr/lib/kodi/kodi.bin+0x13677dc) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb29b340cb in CApplication::Run() (/usr/lib/kodi/kodi.bin+0x13630cb) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb291ef38f in main (/usr/lib/kodi/kodi.bin+0xa1e38f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe459227740  (/usr/lib/libc.so.6+0x27740) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe459227878 in __libc_start_main (/usr/lib/libc.so.6+0x27878) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x55fb29250154 in _start (/usr/lib/kodi/kodi.bin+0xa7f154) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)

SUMMARY: AddressSanitizer: heap-use-after-free /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182 in CFragmentedSampleReader::ReadSample()
Shadow bytes around the buggy address:
  0x7d0453ac2080: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x7d0453ac2100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7d0453ac2180: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
  0x7d0453ac2200: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2280: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x7d0453ac2300: fd fd fd fd fd fd[fd]fd fd fd fd fd fa fa fa fa
  0x7d0453ac2380: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2400: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x7d0453ac2480: fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa
  0x7d0453ac2500: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==219283==ABORTING
dobo90 added a commit to dobo90/inputstream.adaptive that referenced this pull request Jun 8, 2026
…deo) streams

* First patch reverts faulty commit from Kodi fork which introduces
  leaks.
* Second patch is grabbed from upstream Bento4 (and correctly fixes
  issue that faulty commit was trying to fix).
* Third comes from axiomatic-systems/Bento4#1069.

Test stream: https://storage.videos.solomon.tech/streaming-playlists/hls/edfcff7a-a8e1-4326-a2e7-424411aa189f/eaaa4f76-eef4-443e-821c-a34c36c15351-master.m3u8

Address sanitizer reports:

1)
```
Direct leak of 2480 byte(s) in 62 object(s) allocated from:
    #0 0x7f61f712d341 in operator new(unsigned long) (/usr/lib/libasan.so+0x12d341) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7b61a2b33313 in AP4_LinearReader::Advance(bool) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:461
    xbmc#2 0x7b61a2b33709 in AP4_LinearReader::ReadNextSample(unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:540
    xbmc#3 0x7b61a2a41871 in CLinearReader::ExecReadNextSample(CLinearReaderCB*, unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:680
    xbmc#4 0x7b61a2a3beb2 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:158
    xbmc#5 0x7b61a2819586 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#6 0x7b61a2818c4c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#7 0x7b61a2818872 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#8 0x7b61a2818011 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#9 0x7b61a2817c50 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#10 0x7b61a2817889 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#11 0x7b61a28169c9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#12 0x7b61a2818d6b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#13 0x7b61a281891f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#14 0x7b61a28181f4 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#15 0x7b61a2817ccc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#16 0x55873e2f7655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#17 0x7f61f409d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#18 0x7f61f409d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#19 0x7b61a27ff278 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#20 0x7b61a27ff278 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#21 0x7b61a27f5d0f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#22 0x7b61a2816b22 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#23 0x7b61a2802d63 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#24 0x7b61a27fba73 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba73) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#25 0x7b61a2813811 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#26 0x7b61a2812f53 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f53) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#27 0x7b61a2811bae in std::_Function_handler<void (), UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}>::_M_invoke(std::_Any_data const&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa11bae) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#28 0x7b61a2a8d1c1 in std::function<void ()>::operator()() const /usr/include/c++/16.1.1/bits/std_function.h:581
    xbmc#29 0x7b61a2a8c4bb in UTILS::THREAD::ThreadPool::Executor::Run() /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:70
    xbmc#30 0x7b61a2a8f5ca in void std::__invoke_impl<void, void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(std::__invoke_memfun_deref, void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:76
```

2)
```
Indirect leak of 1631788 byte(s) in 62 object(s) allocated from:
    #0 0x7f61f712d4d1 in operator new[](unsigned long) (/usr/lib/libasan.so+0x12d4d1) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7b61a2b28288 in AP4_DataBuffer::ReallocateBuffer(unsigned int) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4DataBuffer.cpp:210
    xbmc#2 0x7b61a2b2813d in AP4_DataBuffer::SetDataSize(unsigned int) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4DataBuffer.cpp:151
    xbmc#3 0x7b61a2b4f537 in AP4_Sample::ReadData(AP4_DataBuffer&, unsigned int, unsigned int) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4Sample.cpp:156
    xbmc#4 0x7b61a2b4f469 in AP4_Sample::ReadData(AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4Sample.cpp:127
    xbmc#5 0x7b61a2b333b1 in AP4_LinearReader::Advance(bool) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:467
    xbmc#6 0x7b61a2b33709 in AP4_LinearReader::ReadNextSample(unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:540
    xbmc#7 0x7b61a2a41871 in CLinearReader::ExecReadNextSample(CLinearReaderCB*, unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:680
    xbmc#8 0x7b61a2a3beb2 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:158
    xbmc#9 0x7b61a2819586 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#10 0x7b61a2818c4c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#11 0x7b61a2818872 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#12 0x7b61a2818011 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#13 0x7b61a2817c50 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#14 0x7b61a2817889 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#15 0x7b61a28169c9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#16 0x7b61a2818d6b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#17 0x7b61a281891f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#18 0x7b61a28181f4 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#19 0x7b61a2817ccc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#20 0x55873e2f7655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#21 0x7f61f409d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#22 0x7f61f409d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#23 0x7b61a27ff278 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#24 0x7b61a27ff278 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#25 0x7b61a27f5d0f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#26 0x7b61a2816b22 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#27 0x7b61a2802d63 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#28 0x7b61a27fba73 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba73) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#29 0x7b61a2813811 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#30 0x7b61a2812f53 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f53) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
```
dobo90 added a commit to dobo90/inputstream.adaptive that referenced this pull request Jun 22, 2026
Fixes following sanitizer report:
=================================================================
==219283==ERROR: AddressSanitizer: heap-use-after-free on address 0x7d0453ac2330 at pc 0x7be408843f2d bp 0x7be40277dbf0 sp 0x7be40277dbe0
READ of size 8 at 0x7d0453ac2330 thread T64
    #0 0x7be408843f2c in std::__shared_ptr<AP4_CencSampleDecrypter, (__gnu_cxx::_Lock_policy)2>::operator bool() const /usr/include/c++/16.1.1/bits/shared_ptr_base.h:1756
    #1 0x7be40883c045 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182
    xbmc#2 0x7be408619596 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#3 0x7be408618c5c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#4 0x7be408618882 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#5 0x7be408618021 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#6 0x7be408617c60 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#7 0x7be408617899 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#8 0x7be4086169d9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#9 0x7be408618d7b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#10 0x7be40861892f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#11 0x7be408618204 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#12 0x7be408617cdc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#13 0x55fb298d6655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe45929d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe45929d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x7be4085ff288 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#17 0x7be4085ff288 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#18 0x7be4085f5d1f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#19 0x7be408616b32 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#20 0x7be408602d73 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#21 0x7be4085fba83 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba83) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#22 0x7be408613821 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#23 0x7be408612f63 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f63) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#24 0x7be408611bbe in std::_Function_handler<void (), UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}>::_M_invoke(std::_Any_data const&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa11bbe) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#25 0x7be40888d1d1 in std::function<void ()>::operator()() const /usr/include/c++/16.1.1/bits/std_function.h:581
    xbmc#26 0x7be40888c4cb in UTILS::THREAD::ThreadPool::Executor::Run() /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:70
    xbmc#27 0x7be40888f5da in void std::__invoke_impl<void, void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(std::__invoke_memfun_deref, void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#28 0x7be40888f4c8 in std::__invoke_result<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>::type std::__invoke<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#29 0x7be40888f44a in void std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/include/c++/16.1.1/bits/std_thread.h:303
    xbmc#30 0x7be40888f403 in std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::operator()() /usr/include/c++/16.1.1/bits/std_thread.h:310
    xbmc#31 0x7be40888f3e7 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> > >::_M_run() /usr/include/c++/16.1.1/bits/std_thread.h:255
    xbmc#32 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#33 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#34 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#35 0x7fe45931d21b  (/usr/lib/libc.so.6+0x11d21b) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

0x7d0453ac2330 is located 240 bytes inside of 288-byte region [0x7d0453ac2240,0x7d0453ac2360)
freed by thread T57 here:
    #0 0x7fe45c12e4c1 in operator delete(void*, unsigned long) (/usr/lib/libasan.so+0x12e4c1) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be40883b3be in CFragmentedSampleReader::~CFragmentedSampleReader() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:62
    xbmc#2 0x7be40863ad02 in std::default_delete<ISampleReader>::operator()(ISampleReader*) const /usr/include/c++/16.1.1/bits/unique_ptr.h:92
    xbmc#3 0x7be4086be093 in std::__uniq_ptr_impl<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:204
    xbmc#4 0x7be4086bd915 in std::unique_ptr<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:511
    xbmc#5 0x7be4086bd1ec in SESSION::CStream::UnlinkStream() /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:114
    xbmc#6 0x7be4085ed98b in CInputStreamAdaptive::EnableStream(int, bool) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:157
    xbmc#7 0x7be4085f9f3f in kodi::addon::CInstanceInputStream::ADDON_EnableStream(AddonInstance_InputStream const*, int, bool) /usr/include/kodi/addon-instance/Inputstream.h:2006
    xbmc#8 0x55fb2953d0bd  (/usr/lib/kodi/kodi.bin+0xd6c0bd) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294ecf1f in CVideoPlayer::OnExit() (/usr/lib/kodi/kodi.bin+0xd1bf1f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb298da2f7 in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092f7) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#13 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#14 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

previously allocated by thread T57 here:
    #0 0x7fe45c12d341 in operator new(unsigned long) (/usr/lib/libasan.so+0x12d341) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be4088442da in std::__detail::_MakeUniq<CFragmentedSampleReader>::__single_object std::make_unique<CFragmentedSampleReader, std::shared_ptr<CLinearReader>&, AP4_Track*&>(std::shared_ptr<CLinearReader>&, AP4_Track*&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#2 0x7be40883d940 in CFragmentedSampleReader::CreateReaderByTrack() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:319
    xbmc#3 0x7be4086bcc85 in SESSION::CStream::LinkStream(std::shared_ptr<SESSION::CStream>, int) /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:78
    xbmc#4 0x7be4085edebf in CInputStreamAdaptive::OpenStream(int) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:285
    xbmc#5 0x7be4085fa046 in kodi::addon::CInstanceInputStream::ADDON_OpenStream(AddonInstance_InputStream const*, int) /usr/include/kodi/addon-instance/Inputstream.h:2012
    xbmc#6 0x55fb29468dac in CDVDDemuxClient::OpenStream(int) (/usr/lib/kodi/kodi.bin+0xc97dac) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb294f5589 in CVideoPlayer::OpenStream(CCurrentStream&, long, int, int, bool) (/usr/lib/kodi/kodi.bin+0xd24589) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb294e7b0a in CVideoPlayer::OpenDefaultStreams(bool) (/usr/lib/kodi/kodi.bin+0xd16b0a) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294e91f4 in CVideoPlayer::Prepare() (/usr/lib/kodi/kodi.bin+0xd181f4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294eab6c in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19b6c) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#14 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#15 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T64 created by T57 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x7be40888d038 in std::thread::thread<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*, void>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/std_thread.h:175
    xbmc#3 0x7be40888c27e in UTILS::THREAD::ThreadPool::Executor::Executor(UTILS::THREAD::ThreadPool&) /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:55
    xbmc#4 0x7be408602f94 in std::__detail::_MakeUniq<UTILS::THREAD::ThreadPool::Executor>::__single_object std::make_unique<UTILS::THREAD::ThreadPool::Executor, UTILS::THREAD::ThreadPool&>(UTILS::THREAD::ThreadPool&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#5 0x7be4085fbf72 in auto UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fbf72) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#6 0x7be4085fc3dc in ISampleReader::ReadSampleAsync() (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fc3dc) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#7 0x7be4085ef0b8 in CInputStreamAdaptive::DemuxRead() /home/dobo/kodi/inputstream.adaptive/src/main.cpp:381
    xbmc#8 0x7be4085fa449 in kodi::addon::CInstanceInputStream::ADDON_DemuxRead(AddonInstance_InputStream const*) /usr/include/kodi/addon-instance/Inputstream.h:2032
    xbmc#9 0x55fb294688a4 in CDVDDemuxClient::Read() (/usr/lib/kodi/kodi.bin+0xc978a4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294e869d in CVideoPlayer::ReadPacket(DemuxPacket*&, CDemuxStream*&) (/usr/lib/kodi/kodi.bin+0xd1769d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb294eae22 in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19e22) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#15 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#16 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T57 created by T0 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x55fb298da1a2  (/usr/lib/kodi/kodi.bin+0x11091a2) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#3 0x55fb294e3181 in CVideoPlayer::OpenFile(CFileItem const&, CPlayerOptions const&) (/usr/lib/kodi/kodi.bin+0xd12181) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#4 0x55fb29b5310d in CApplicationPlayer::OpenFile(CFileItem const&, CPlayerOptions const&, CPlayerCoreFactory const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, IPlayerCallback&) (/usr/lib/kodi/kodi.bin+0x138210d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#5 0x55fb29b347ca in CApplication::PlayFile(CFileItem, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (/usr/lib/kodi/kodi.bin+0x13637ca) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#6 0x55fb29d7ecd8 in KODI::PLAYLIST::CPlayListPlayer::Play(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool) (/usr/lib/kodi/kodi.bin+0x15adcd8) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb29d7f9ef in KODI::PLAYLIST::CPlayListPlayer::Play() (/usr/lib/kodi/kodi.bin+0x15ae9ef) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb29d8ae07 in KODI::PLAYLIST::CPlayListPlayer::OnApplicationMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x15b9e07) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb2994f9b5 in KODI::MESSAGING::CApplicationMessenger::ProcessMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x117e9b5) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb2994fb85 in KODI::MESSAGING::CApplicationMessenger::ProcessMessages() (/usr/lib/kodi/kodi.bin+0x117eb85) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb29b387dc in CApplication::Process() (/usr/lib/kodi/kodi.bin+0x13677dc) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb29b340cb in CApplication::Run() (/usr/lib/kodi/kodi.bin+0x13630cb) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb291ef38f in main (/usr/lib/kodi/kodi.bin+0xa1e38f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe459227740  (/usr/lib/libc.so.6+0x27740) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe459227878 in __libc_start_main (/usr/lib/libc.so.6+0x27878) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x55fb29250154 in _start (/usr/lib/kodi/kodi.bin+0xa7f154) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)

SUMMARY: AddressSanitizer: heap-use-after-free /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182 in CFragmentedSampleReader::ReadSample()
Shadow bytes around the buggy address:
  0x7d0453ac2080: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x7d0453ac2100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7d0453ac2180: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
  0x7d0453ac2200: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2280: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x7d0453ac2300: fd fd fd fd fd fd[fd]fd fd fd fd fd fa fa fa fa
  0x7d0453ac2380: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2400: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x7d0453ac2480: fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa
  0x7d0453ac2500: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==219283==ABORTING
dobo90 added a commit to dobo90/inputstream.adaptive that referenced this pull request Jun 22, 2026
…deo) streams

* First patch reverts faulty commit from Kodi fork which introduces
  leaks.
* Second patch is grabbed from upstream Bento4 (and correctly fixes
  issue that faulty commit was trying to fix).
* Third comes from axiomatic-systems/Bento4#1069.

Test stream: https://storage.videos.solomon.tech/streaming-playlists/hls/edfcff7a-a8e1-4326-a2e7-424411aa189f/eaaa4f76-eef4-443e-821c-a34c36c15351-master.m3u8

Address sanitizer reports:

1)
```
Direct leak of 2480 byte(s) in 62 object(s) allocated from:
    #0 0x7f61f712d341 in operator new(unsigned long) (/usr/lib/libasan.so+0x12d341) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7b61a2b33313 in AP4_LinearReader::Advance(bool) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:461
    xbmc#2 0x7b61a2b33709 in AP4_LinearReader::ReadNextSample(unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:540
    xbmc#3 0x7b61a2a41871 in CLinearReader::ExecReadNextSample(CLinearReaderCB*, unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:680
    xbmc#4 0x7b61a2a3beb2 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:158
    xbmc#5 0x7b61a2819586 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#6 0x7b61a2818c4c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#7 0x7b61a2818872 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#8 0x7b61a2818011 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#9 0x7b61a2817c50 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#10 0x7b61a2817889 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#11 0x7b61a28169c9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#12 0x7b61a2818d6b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#13 0x7b61a281891f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#14 0x7b61a28181f4 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#15 0x7b61a2817ccc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#16 0x55873e2f7655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#17 0x7f61f409d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#18 0x7f61f409d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#19 0x7b61a27ff278 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#20 0x7b61a27ff278 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#21 0x7b61a27f5d0f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#22 0x7b61a2816b22 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#23 0x7b61a2802d63 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#24 0x7b61a27fba73 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba73) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#25 0x7b61a2813811 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#26 0x7b61a2812f53 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f53) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#27 0x7b61a2811bae in std::_Function_handler<void (), UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}>::_M_invoke(std::_Any_data const&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa11bae) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#28 0x7b61a2a8d1c1 in std::function<void ()>::operator()() const /usr/include/c++/16.1.1/bits/std_function.h:581
    xbmc#29 0x7b61a2a8c4bb in UTILS::THREAD::ThreadPool::Executor::Run() /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:70
    xbmc#30 0x7b61a2a8f5ca in void std::__invoke_impl<void, void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(std::__invoke_memfun_deref, void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:76
```

2)
```
Indirect leak of 1631788 byte(s) in 62 object(s) allocated from:
    #0 0x7f61f712d4d1 in operator new[](unsigned long) (/usr/lib/libasan.so+0x12d4d1) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7b61a2b28288 in AP4_DataBuffer::ReallocateBuffer(unsigned int) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4DataBuffer.cpp:210
    xbmc#2 0x7b61a2b2813d in AP4_DataBuffer::SetDataSize(unsigned int) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4DataBuffer.cpp:151
    xbmc#3 0x7b61a2b4f537 in AP4_Sample::ReadData(AP4_DataBuffer&, unsigned int, unsigned int) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4Sample.cpp:156
    xbmc#4 0x7b61a2b4f469 in AP4_Sample::ReadData(AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4Sample.cpp:127
    xbmc#5 0x7b61a2b333b1 in AP4_LinearReader::Advance(bool) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:467
    xbmc#6 0x7b61a2b33709 in AP4_LinearReader::ReadNextSample(unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:540
    xbmc#7 0x7b61a2a41871 in CLinearReader::ExecReadNextSample(CLinearReaderCB*, unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:680
    xbmc#8 0x7b61a2a3beb2 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:158
    xbmc#9 0x7b61a2819586 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#10 0x7b61a2818c4c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#11 0x7b61a2818872 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#12 0x7b61a2818011 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#13 0x7b61a2817c50 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#14 0x7b61a2817889 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#15 0x7b61a28169c9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#16 0x7b61a2818d6b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#17 0x7b61a281891f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#18 0x7b61a28181f4 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#19 0x7b61a2817ccc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#20 0x55873e2f7655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#21 0x7f61f409d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#22 0x7f61f409d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#23 0x7b61a27ff278 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#24 0x7b61a27ff278 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#25 0x7b61a27f5d0f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#26 0x7b61a2816b22 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#27 0x7b61a2802d63 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#28 0x7b61a27fba73 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba73) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#29 0x7b61a2813811 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#30 0x7b61a2812f53 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f53) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
```
dobo90 added a commit to dobo90/inputstream.adaptive that referenced this pull request Jun 28, 2026
Fixes following sanitizer report:
=================================================================
==219283==ERROR: AddressSanitizer: heap-use-after-free on address 0x7d0453ac2330 at pc 0x7be408843f2d bp 0x7be40277dbf0 sp 0x7be40277dbe0
READ of size 8 at 0x7d0453ac2330 thread T64
    #0 0x7be408843f2c in std::__shared_ptr<AP4_CencSampleDecrypter, (__gnu_cxx::_Lock_policy)2>::operator bool() const /usr/include/c++/16.1.1/bits/shared_ptr_base.h:1756
    #1 0x7be40883c045 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182
    xbmc#2 0x7be408619596 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#3 0x7be408618c5c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#4 0x7be408618882 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#5 0x7be408618021 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#6 0x7be408617c60 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#7 0x7be408617899 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#8 0x7be4086169d9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#9 0x7be408618d7b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#10 0x7be40861892f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#11 0x7be408618204 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#12 0x7be408617cdc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#13 0x55fb298d6655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe45929d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe45929d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x7be4085ff288 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#17 0x7be4085ff288 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#18 0x7be4085f5d1f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#19 0x7be408616b32 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#20 0x7be408602d73 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#21 0x7be4085fba83 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba83) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#22 0x7be408613821 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#23 0x7be408612f63 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f63) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#24 0x7be408611bbe in std::_Function_handler<void (), UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}>::_M_invoke(std::_Any_data const&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa11bbe) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#25 0x7be40888d1d1 in std::function<void ()>::operator()() const /usr/include/c++/16.1.1/bits/std_function.h:581
    xbmc#26 0x7be40888c4cb in UTILS::THREAD::ThreadPool::Executor::Run() /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:70
    xbmc#27 0x7be40888f5da in void std::__invoke_impl<void, void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(std::__invoke_memfun_deref, void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#28 0x7be40888f4c8 in std::__invoke_result<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>::type std::__invoke<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#29 0x7be40888f44a in void std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/include/c++/16.1.1/bits/std_thread.h:303
    xbmc#30 0x7be40888f403 in std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::operator()() /usr/include/c++/16.1.1/bits/std_thread.h:310
    xbmc#31 0x7be40888f3e7 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> > >::_M_run() /usr/include/c++/16.1.1/bits/std_thread.h:255
    xbmc#32 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#33 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#34 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#35 0x7fe45931d21b  (/usr/lib/libc.so.6+0x11d21b) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

0x7d0453ac2330 is located 240 bytes inside of 288-byte region [0x7d0453ac2240,0x7d0453ac2360)
freed by thread T57 here:
    #0 0x7fe45c12e4c1 in operator delete(void*, unsigned long) (/usr/lib/libasan.so+0x12e4c1) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be40883b3be in CFragmentedSampleReader::~CFragmentedSampleReader() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:62
    xbmc#2 0x7be40863ad02 in std::default_delete<ISampleReader>::operator()(ISampleReader*) const /usr/include/c++/16.1.1/bits/unique_ptr.h:92
    xbmc#3 0x7be4086be093 in std::__uniq_ptr_impl<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:204
    xbmc#4 0x7be4086bd915 in std::unique_ptr<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:511
    xbmc#5 0x7be4086bd1ec in SESSION::CStream::UnlinkStream() /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:114
    xbmc#6 0x7be4085ed98b in CInputStreamAdaptive::EnableStream(int, bool) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:157
    xbmc#7 0x7be4085f9f3f in kodi::addon::CInstanceInputStream::ADDON_EnableStream(AddonInstance_InputStream const*, int, bool) /usr/include/kodi/addon-instance/Inputstream.h:2006
    xbmc#8 0x55fb2953d0bd  (/usr/lib/kodi/kodi.bin+0xd6c0bd) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294ecf1f in CVideoPlayer::OnExit() (/usr/lib/kodi/kodi.bin+0xd1bf1f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb298da2f7 in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092f7) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#13 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#14 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

previously allocated by thread T57 here:
    #0 0x7fe45c12d341 in operator new(unsigned long) (/usr/lib/libasan.so+0x12d341) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be4088442da in std::__detail::_MakeUniq<CFragmentedSampleReader>::__single_object std::make_unique<CFragmentedSampleReader, std::shared_ptr<CLinearReader>&, AP4_Track*&>(std::shared_ptr<CLinearReader>&, AP4_Track*&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#2 0x7be40883d940 in CFragmentedSampleReader::CreateReaderByTrack() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:319
    xbmc#3 0x7be4086bcc85 in SESSION::CStream::LinkStream(std::shared_ptr<SESSION::CStream>, int) /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:78
    xbmc#4 0x7be4085edebf in CInputStreamAdaptive::OpenStream(int) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:285
    xbmc#5 0x7be4085fa046 in kodi::addon::CInstanceInputStream::ADDON_OpenStream(AddonInstance_InputStream const*, int) /usr/include/kodi/addon-instance/Inputstream.h:2012
    xbmc#6 0x55fb29468dac in CDVDDemuxClient::OpenStream(int) (/usr/lib/kodi/kodi.bin+0xc97dac) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb294f5589 in CVideoPlayer::OpenStream(CCurrentStream&, long, int, int, bool) (/usr/lib/kodi/kodi.bin+0xd24589) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb294e7b0a in CVideoPlayer::OpenDefaultStreams(bool) (/usr/lib/kodi/kodi.bin+0xd16b0a) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294e91f4 in CVideoPlayer::Prepare() (/usr/lib/kodi/kodi.bin+0xd181f4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294eab6c in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19b6c) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#14 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#15 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T64 created by T57 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x7be40888d038 in std::thread::thread<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*, void>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/std_thread.h:175
    xbmc#3 0x7be40888c27e in UTILS::THREAD::ThreadPool::Executor::Executor(UTILS::THREAD::ThreadPool&) /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:55
    xbmc#4 0x7be408602f94 in std::__detail::_MakeUniq<UTILS::THREAD::ThreadPool::Executor>::__single_object std::make_unique<UTILS::THREAD::ThreadPool::Executor, UTILS::THREAD::ThreadPool&>(UTILS::THREAD::ThreadPool&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#5 0x7be4085fbf72 in auto UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fbf72) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#6 0x7be4085fc3dc in ISampleReader::ReadSampleAsync() (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fc3dc) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#7 0x7be4085ef0b8 in CInputStreamAdaptive::DemuxRead() /home/dobo/kodi/inputstream.adaptive/src/main.cpp:381
    xbmc#8 0x7be4085fa449 in kodi::addon::CInstanceInputStream::ADDON_DemuxRead(AddonInstance_InputStream const*) /usr/include/kodi/addon-instance/Inputstream.h:2032
    xbmc#9 0x55fb294688a4 in CDVDDemuxClient::Read() (/usr/lib/kodi/kodi.bin+0xc978a4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294e869d in CVideoPlayer::ReadPacket(DemuxPacket*&, CDemuxStream*&) (/usr/lib/kodi/kodi.bin+0xd1769d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb294eae22 in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19e22) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#15 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#16 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T57 created by T0 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x55fb298da1a2  (/usr/lib/kodi/kodi.bin+0x11091a2) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#3 0x55fb294e3181 in CVideoPlayer::OpenFile(CFileItem const&, CPlayerOptions const&) (/usr/lib/kodi/kodi.bin+0xd12181) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#4 0x55fb29b5310d in CApplicationPlayer::OpenFile(CFileItem const&, CPlayerOptions const&, CPlayerCoreFactory const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, IPlayerCallback&) (/usr/lib/kodi/kodi.bin+0x138210d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#5 0x55fb29b347ca in CApplication::PlayFile(CFileItem, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (/usr/lib/kodi/kodi.bin+0x13637ca) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#6 0x55fb29d7ecd8 in KODI::PLAYLIST::CPlayListPlayer::Play(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool) (/usr/lib/kodi/kodi.bin+0x15adcd8) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb29d7f9ef in KODI::PLAYLIST::CPlayListPlayer::Play() (/usr/lib/kodi/kodi.bin+0x15ae9ef) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb29d8ae07 in KODI::PLAYLIST::CPlayListPlayer::OnApplicationMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x15b9e07) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb2994f9b5 in KODI::MESSAGING::CApplicationMessenger::ProcessMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x117e9b5) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb2994fb85 in KODI::MESSAGING::CApplicationMessenger::ProcessMessages() (/usr/lib/kodi/kodi.bin+0x117eb85) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb29b387dc in CApplication::Process() (/usr/lib/kodi/kodi.bin+0x13677dc) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb29b340cb in CApplication::Run() (/usr/lib/kodi/kodi.bin+0x13630cb) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb291ef38f in main (/usr/lib/kodi/kodi.bin+0xa1e38f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe459227740  (/usr/lib/libc.so.6+0x27740) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe459227878 in __libc_start_main (/usr/lib/libc.so.6+0x27878) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x55fb29250154 in _start (/usr/lib/kodi/kodi.bin+0xa7f154) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)

SUMMARY: AddressSanitizer: heap-use-after-free /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182 in CFragmentedSampleReader::ReadSample()
Shadow bytes around the buggy address:
  0x7d0453ac2080: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x7d0453ac2100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7d0453ac2180: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
  0x7d0453ac2200: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2280: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x7d0453ac2300: fd fd fd fd fd fd[fd]fd fd fd fd fd fa fa fa fa
  0x7d0453ac2380: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2400: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x7d0453ac2480: fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa
  0x7d0453ac2500: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==219283==ABORTING
dobo90 added a commit to dobo90/inputstream.adaptive that referenced this pull request Jun 28, 2026
…deo) streams

* First patch reverts faulty commit from Kodi fork which introduces
  leaks.
* Second patch is grabbed from upstream Bento4 (and correctly fixes
  issue that faulty commit was trying to fix).
* Third comes from axiomatic-systems/Bento4#1069.

Test stream: https://storage.videos.solomon.tech/streaming-playlists/hls/edfcff7a-a8e1-4326-a2e7-424411aa189f/eaaa4f76-eef4-443e-821c-a34c36c15351-master.m3u8

Address sanitizer reports:

1)
```
Direct leak of 2480 byte(s) in 62 object(s) allocated from:
    #0 0x7f61f712d341 in operator new(unsigned long) (/usr/lib/libasan.so+0x12d341) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7b61a2b33313 in AP4_LinearReader::Advance(bool) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:461
    xbmc#2 0x7b61a2b33709 in AP4_LinearReader::ReadNextSample(unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:540
    xbmc#3 0x7b61a2a41871 in CLinearReader::ExecReadNextSample(CLinearReaderCB*, unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:680
    xbmc#4 0x7b61a2a3beb2 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:158
    xbmc#5 0x7b61a2819586 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#6 0x7b61a2818c4c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#7 0x7b61a2818872 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#8 0x7b61a2818011 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#9 0x7b61a2817c50 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#10 0x7b61a2817889 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#11 0x7b61a28169c9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#12 0x7b61a2818d6b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#13 0x7b61a281891f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#14 0x7b61a28181f4 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#15 0x7b61a2817ccc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#16 0x55873e2f7655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#17 0x7f61f409d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#18 0x7f61f409d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#19 0x7b61a27ff278 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#20 0x7b61a27ff278 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#21 0x7b61a27f5d0f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#22 0x7b61a2816b22 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#23 0x7b61a2802d63 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#24 0x7b61a27fba73 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba73) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#25 0x7b61a2813811 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#26 0x7b61a2812f53 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f53) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#27 0x7b61a2811bae in std::_Function_handler<void (), UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}>::_M_invoke(std::_Any_data const&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa11bae) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#28 0x7b61a2a8d1c1 in std::function<void ()>::operator()() const /usr/include/c++/16.1.1/bits/std_function.h:581
    xbmc#29 0x7b61a2a8c4bb in UTILS::THREAD::ThreadPool::Executor::Run() /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:70
    xbmc#30 0x7b61a2a8f5ca in void std::__invoke_impl<void, void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(std::__invoke_memfun_deref, void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:76
```

2)
```
Indirect leak of 1631788 byte(s) in 62 object(s) allocated from:
    #0 0x7f61f712d4d1 in operator new[](unsigned long) (/usr/lib/libasan.so+0x12d4d1) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7b61a2b28288 in AP4_DataBuffer::ReallocateBuffer(unsigned int) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4DataBuffer.cpp:210
    xbmc#2 0x7b61a2b2813d in AP4_DataBuffer::SetDataSize(unsigned int) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4DataBuffer.cpp:151
    xbmc#3 0x7b61a2b4f537 in AP4_Sample::ReadData(AP4_DataBuffer&, unsigned int, unsigned int) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4Sample.cpp:156
    xbmc#4 0x7b61a2b4f469 in AP4_Sample::ReadData(AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4Sample.cpp:127
    xbmc#5 0x7b61a2b333b1 in AP4_LinearReader::Advance(bool) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:467
    xbmc#6 0x7b61a2b33709 in AP4_LinearReader::ReadNextSample(unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/bento4/src/bento4/Source/C++/Core/Ap4LinearReader.cpp:540
    xbmc#7 0x7b61a2a41871 in CLinearReader::ExecReadNextSample(CLinearReaderCB*, unsigned int, AP4_Sample&, AP4_DataBuffer&) /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:680
    xbmc#8 0x7b61a2a3beb2 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:158
    xbmc#9 0x7b61a2819586 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#10 0x7b61a2818c4c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#11 0x7b61a2818872 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#12 0x7b61a2818011 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#13 0x7b61a2817c50 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#14 0x7b61a2817889 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#15 0x7b61a28169c9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#16 0x7b61a2818d6b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#17 0x7b61a281891f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#18 0x7b61a28181f4 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#19 0x7b61a2817ccc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#20 0x55873e2f7655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#21 0x7f61f409d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#22 0x7f61f409d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#23 0x7b61a27ff278 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#24 0x7b61a27ff278 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#25 0x7b61a27f5d0f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#26 0x7b61a2816b22 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#27 0x7b61a2802d63 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#28 0x7b61a27fba73 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba73) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
    xbmc#29 0x7b61a2813811 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#30 0x7b61a2812f53 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f53) (BuildId: 10f583c374d6f7aa219a9f7ab1bbc26a66df313c)
```
dobo90 added a commit to dobo90/inputstream.adaptive that referenced this pull request Jul 13, 2026
Fixes following sanitizer report:
=================================================================
==219283==ERROR: AddressSanitizer: heap-use-after-free on address 0x7d0453ac2330 at pc 0x7be408843f2d bp 0x7be40277dbf0 sp 0x7be40277dbe0
READ of size 8 at 0x7d0453ac2330 thread T64
    #0 0x7be408843f2c in std::__shared_ptr<AP4_CencSampleDecrypter, (__gnu_cxx::_Lock_policy)2>::operator bool() const /usr/include/c++/16.1.1/bits/shared_ptr_base.h:1756
    #1 0x7be40883c045 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182
    xbmc#2 0x7be408619596 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#3 0x7be408618c5c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#4 0x7be408618882 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#5 0x7be408618021 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#6 0x7be408617c60 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#7 0x7be408617899 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#8 0x7be4086169d9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#9 0x7be408618d7b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#10 0x7be40861892f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#11 0x7be408618204 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#12 0x7be408617cdc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#13 0x55fb298d6655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe45929d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe45929d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x7be4085ff288 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#17 0x7be4085ff288 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#18 0x7be4085f5d1f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#19 0x7be408616b32 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#20 0x7be408602d73 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#21 0x7be4085fba83 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba83) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#22 0x7be408613821 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#23 0x7be408612f63 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f63) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#24 0x7be408611bbe in std::_Function_handler<void (), UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}>::_M_invoke(std::_Any_data const&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa11bbe) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#25 0x7be40888d1d1 in std::function<void ()>::operator()() const /usr/include/c++/16.1.1/bits/std_function.h:581
    xbmc#26 0x7be40888c4cb in UTILS::THREAD::ThreadPool::Executor::Run() /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:70
    xbmc#27 0x7be40888f5da in void std::__invoke_impl<void, void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(std::__invoke_memfun_deref, void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#28 0x7be40888f4c8 in std::__invoke_result<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>::type std::__invoke<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#29 0x7be40888f44a in void std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/include/c++/16.1.1/bits/std_thread.h:303
    xbmc#30 0x7be40888f403 in std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::operator()() /usr/include/c++/16.1.1/bits/std_thread.h:310
    xbmc#31 0x7be40888f3e7 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> > >::_M_run() /usr/include/c++/16.1.1/bits/std_thread.h:255
    xbmc#32 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#33 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#34 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#35 0x7fe45931d21b  (/usr/lib/libc.so.6+0x11d21b) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

0x7d0453ac2330 is located 240 bytes inside of 288-byte region [0x7d0453ac2240,0x7d0453ac2360)
freed by thread T57 here:
    #0 0x7fe45c12e4c1 in operator delete(void*, unsigned long) (/usr/lib/libasan.so+0x12e4c1) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be40883b3be in CFragmentedSampleReader::~CFragmentedSampleReader() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:62
    xbmc#2 0x7be40863ad02 in std::default_delete<ISampleReader>::operator()(ISampleReader*) const /usr/include/c++/16.1.1/bits/unique_ptr.h:92
    xbmc#3 0x7be4086be093 in std::__uniq_ptr_impl<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:204
    xbmc#4 0x7be4086bd915 in std::unique_ptr<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:511
    xbmc#5 0x7be4086bd1ec in SESSION::CStream::UnlinkStream() /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:114
    xbmc#6 0x7be4085ed98b in CInputStreamAdaptive::EnableStream(int, bool) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:157
    xbmc#7 0x7be4085f9f3f in kodi::addon::CInstanceInputStream::ADDON_EnableStream(AddonInstance_InputStream const*, int, bool) /usr/include/kodi/addon-instance/Inputstream.h:2006
    xbmc#8 0x55fb2953d0bd  (/usr/lib/kodi/kodi.bin+0xd6c0bd) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294ecf1f in CVideoPlayer::OnExit() (/usr/lib/kodi/kodi.bin+0xd1bf1f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb298da2f7 in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092f7) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#13 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#14 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

previously allocated by thread T57 here:
    #0 0x7fe45c12d341 in operator new(unsigned long) (/usr/lib/libasan.so+0x12d341) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be4088442da in std::__detail::_MakeUniq<CFragmentedSampleReader>::__single_object std::make_unique<CFragmentedSampleReader, std::shared_ptr<CLinearReader>&, AP4_Track*&>(std::shared_ptr<CLinearReader>&, AP4_Track*&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#2 0x7be40883d940 in CFragmentedSampleReader::CreateReaderByTrack() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:319
    xbmc#3 0x7be4086bcc85 in SESSION::CStream::LinkStream(std::shared_ptr<SESSION::CStream>, int) /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:78
    xbmc#4 0x7be4085edebf in CInputStreamAdaptive::OpenStream(int) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:285
    xbmc#5 0x7be4085fa046 in kodi::addon::CInstanceInputStream::ADDON_OpenStream(AddonInstance_InputStream const*, int) /usr/include/kodi/addon-instance/Inputstream.h:2012
    xbmc#6 0x55fb29468dac in CDVDDemuxClient::OpenStream(int) (/usr/lib/kodi/kodi.bin+0xc97dac) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb294f5589 in CVideoPlayer::OpenStream(CCurrentStream&, long, int, int, bool) (/usr/lib/kodi/kodi.bin+0xd24589) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb294e7b0a in CVideoPlayer::OpenDefaultStreams(bool) (/usr/lib/kodi/kodi.bin+0xd16b0a) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294e91f4 in CVideoPlayer::Prepare() (/usr/lib/kodi/kodi.bin+0xd181f4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294eab6c in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19b6c) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#14 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#15 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T64 created by T57 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x7be40888d038 in std::thread::thread<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*, void>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/std_thread.h:175
    xbmc#3 0x7be40888c27e in UTILS::THREAD::ThreadPool::Executor::Executor(UTILS::THREAD::ThreadPool&) /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:55
    xbmc#4 0x7be408602f94 in std::__detail::_MakeUniq<UTILS::THREAD::ThreadPool::Executor>::__single_object std::make_unique<UTILS::THREAD::ThreadPool::Executor, UTILS::THREAD::ThreadPool&>(UTILS::THREAD::ThreadPool&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#5 0x7be4085fbf72 in auto UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fbf72) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#6 0x7be4085fc3dc in ISampleReader::ReadSampleAsync() (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fc3dc) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#7 0x7be4085ef0b8 in CInputStreamAdaptive::DemuxRead() /home/dobo/kodi/inputstream.adaptive/src/main.cpp:381
    xbmc#8 0x7be4085fa449 in kodi::addon::CInstanceInputStream::ADDON_DemuxRead(AddonInstance_InputStream const*) /usr/include/kodi/addon-instance/Inputstream.h:2032
    xbmc#9 0x55fb294688a4 in CDVDDemuxClient::Read() (/usr/lib/kodi/kodi.bin+0xc978a4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294e869d in CVideoPlayer::ReadPacket(DemuxPacket*&, CDemuxStream*&) (/usr/lib/kodi/kodi.bin+0xd1769d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb294eae22 in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19e22) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#15 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#16 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T57 created by T0 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x55fb298da1a2  (/usr/lib/kodi/kodi.bin+0x11091a2) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#3 0x55fb294e3181 in CVideoPlayer::OpenFile(CFileItem const&, CPlayerOptions const&) (/usr/lib/kodi/kodi.bin+0xd12181) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#4 0x55fb29b5310d in CApplicationPlayer::OpenFile(CFileItem const&, CPlayerOptions const&, CPlayerCoreFactory const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, IPlayerCallback&) (/usr/lib/kodi/kodi.bin+0x138210d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#5 0x55fb29b347ca in CApplication::PlayFile(CFileItem, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (/usr/lib/kodi/kodi.bin+0x13637ca) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#6 0x55fb29d7ecd8 in KODI::PLAYLIST::CPlayListPlayer::Play(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool) (/usr/lib/kodi/kodi.bin+0x15adcd8) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb29d7f9ef in KODI::PLAYLIST::CPlayListPlayer::Play() (/usr/lib/kodi/kodi.bin+0x15ae9ef) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb29d8ae07 in KODI::PLAYLIST::CPlayListPlayer::OnApplicationMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x15b9e07) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb2994f9b5 in KODI::MESSAGING::CApplicationMessenger::ProcessMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x117e9b5) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb2994fb85 in KODI::MESSAGING::CApplicationMessenger::ProcessMessages() (/usr/lib/kodi/kodi.bin+0x117eb85) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb29b387dc in CApplication::Process() (/usr/lib/kodi/kodi.bin+0x13677dc) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb29b340cb in CApplication::Run() (/usr/lib/kodi/kodi.bin+0x13630cb) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb291ef38f in main (/usr/lib/kodi/kodi.bin+0xa1e38f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe459227740  (/usr/lib/libc.so.6+0x27740) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe459227878 in __libc_start_main (/usr/lib/libc.so.6+0x27878) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x55fb29250154 in _start (/usr/lib/kodi/kodi.bin+0xa7f154) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)

SUMMARY: AddressSanitizer: heap-use-after-free /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182 in CFragmentedSampleReader::ReadSample()
Shadow bytes around the buggy address:
  0x7d0453ac2080: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x7d0453ac2100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7d0453ac2180: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
  0x7d0453ac2200: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2280: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x7d0453ac2300: fd fd fd fd fd fd[fd]fd fd fd fd fd fa fa fa fa
  0x7d0453ac2380: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2400: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x7d0453ac2480: fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa
  0x7d0453ac2500: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==219283==ABORTING
dobo90 added a commit to dobo90/inputstream.adaptive that referenced this pull request Jul 13, 2026
Fixes following sanitizer report:
=================================================================
==219283==ERROR: AddressSanitizer: heap-use-after-free on address 0x7d0453ac2330 at pc 0x7be408843f2d bp 0x7be40277dbf0 sp 0x7be40277dbe0
READ of size 8 at 0x7d0453ac2330 thread T64
    #0 0x7be408843f2c in std::__shared_ptr<AP4_CencSampleDecrypter, (__gnu_cxx::_Lock_policy)2>::operator bool() const /usr/include/c++/16.1.1/bits/shared_ptr_base.h:1756
    #1 0x7be40883c045 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182
    xbmc#2 0x7be408619596 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#3 0x7be408618c5c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#4 0x7be408618882 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#5 0x7be408618021 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#6 0x7be408617c60 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#7 0x7be408617899 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#8 0x7be4086169d9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#9 0x7be408618d7b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#10 0x7be40861892f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#11 0x7be408618204 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#12 0x7be408617cdc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#13 0x55fb298d6655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe45929d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe45929d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x7be4085ff288 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#17 0x7be4085ff288 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#18 0x7be4085f5d1f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#19 0x7be408616b32 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#20 0x7be408602d73 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#21 0x7be4085fba83 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba83) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#22 0x7be408613821 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#23 0x7be408612f63 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f63) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#24 0x7be408611bbe in std::_Function_handler<void (), UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}>::_M_invoke(std::_Any_data const&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa11bbe) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#25 0x7be40888d1d1 in std::function<void ()>::operator()() const /usr/include/c++/16.1.1/bits/std_function.h:581
    xbmc#26 0x7be40888c4cb in UTILS::THREAD::ThreadPool::Executor::Run() /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:70
    xbmc#27 0x7be40888f5da in void std::__invoke_impl<void, void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(std::__invoke_memfun_deref, void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#28 0x7be40888f4c8 in std::__invoke_result<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>::type std::__invoke<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#29 0x7be40888f44a in void std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/include/c++/16.1.1/bits/std_thread.h:303
    xbmc#30 0x7be40888f403 in std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::operator()() /usr/include/c++/16.1.1/bits/std_thread.h:310
    xbmc#31 0x7be40888f3e7 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> > >::_M_run() /usr/include/c++/16.1.1/bits/std_thread.h:255
    xbmc#32 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#33 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#34 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#35 0x7fe45931d21b  (/usr/lib/libc.so.6+0x11d21b) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

0x7d0453ac2330 is located 240 bytes inside of 288-byte region [0x7d0453ac2240,0x7d0453ac2360)
freed by thread T57 here:
    #0 0x7fe45c12e4c1 in operator delete(void*, unsigned long) (/usr/lib/libasan.so+0x12e4c1) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be40883b3be in CFragmentedSampleReader::~CFragmentedSampleReader() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:62
    xbmc#2 0x7be40863ad02 in std::default_delete<ISampleReader>::operator()(ISampleReader*) const /usr/include/c++/16.1.1/bits/unique_ptr.h:92
    xbmc#3 0x7be4086be093 in std::__uniq_ptr_impl<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:204
    xbmc#4 0x7be4086bd915 in std::unique_ptr<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:511
    xbmc#5 0x7be4086bd1ec in SESSION::CStream::UnlinkStream() /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:114
    xbmc#6 0x7be4085ed98b in CInputStreamAdaptive::EnableStream(int, bool) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:157
    xbmc#7 0x7be4085f9f3f in kodi::addon::CInstanceInputStream::ADDON_EnableStream(AddonInstance_InputStream const*, int, bool) /usr/include/kodi/addon-instance/Inputstream.h:2006
    xbmc#8 0x55fb2953d0bd  (/usr/lib/kodi/kodi.bin+0xd6c0bd) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294ecf1f in CVideoPlayer::OnExit() (/usr/lib/kodi/kodi.bin+0xd1bf1f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb298da2f7 in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092f7) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#13 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#14 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

previously allocated by thread T57 here:
    #0 0x7fe45c12d341 in operator new(unsigned long) (/usr/lib/libasan.so+0x12d341) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be4088442da in std::__detail::_MakeUniq<CFragmentedSampleReader>::__single_object std::make_unique<CFragmentedSampleReader, std::shared_ptr<CLinearReader>&, AP4_Track*&>(std::shared_ptr<CLinearReader>&, AP4_Track*&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#2 0x7be40883d940 in CFragmentedSampleReader::CreateReaderByTrack() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:319
    xbmc#3 0x7be4086bcc85 in SESSION::CStream::LinkStream(std::shared_ptr<SESSION::CStream>, int) /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:78
    xbmc#4 0x7be4085edebf in CInputStreamAdaptive::OpenStream(int) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:285
    xbmc#5 0x7be4085fa046 in kodi::addon::CInstanceInputStream::ADDON_OpenStream(AddonInstance_InputStream const*, int) /usr/include/kodi/addon-instance/Inputstream.h:2012
    xbmc#6 0x55fb29468dac in CDVDDemuxClient::OpenStream(int) (/usr/lib/kodi/kodi.bin+0xc97dac) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb294f5589 in CVideoPlayer::OpenStream(CCurrentStream&, long, int, int, bool) (/usr/lib/kodi/kodi.bin+0xd24589) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb294e7b0a in CVideoPlayer::OpenDefaultStreams(bool) (/usr/lib/kodi/kodi.bin+0xd16b0a) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294e91f4 in CVideoPlayer::Prepare() (/usr/lib/kodi/kodi.bin+0xd181f4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294eab6c in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19b6c) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#14 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#15 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T64 created by T57 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x7be40888d038 in std::thread::thread<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*, void>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/std_thread.h:175
    xbmc#3 0x7be40888c27e in UTILS::THREAD::ThreadPool::Executor::Executor(UTILS::THREAD::ThreadPool&) /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:55
    xbmc#4 0x7be408602f94 in std::__detail::_MakeUniq<UTILS::THREAD::ThreadPool::Executor>::__single_object std::make_unique<UTILS::THREAD::ThreadPool::Executor, UTILS::THREAD::ThreadPool&>(UTILS::THREAD::ThreadPool&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#5 0x7be4085fbf72 in auto UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fbf72) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#6 0x7be4085fc3dc in ISampleReader::ReadSampleAsync() (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fc3dc) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#7 0x7be4085ef0b8 in CInputStreamAdaptive::DemuxRead() /home/dobo/kodi/inputstream.adaptive/src/main.cpp:381
    xbmc#8 0x7be4085fa449 in kodi::addon::CInstanceInputStream::ADDON_DemuxRead(AddonInstance_InputStream const*) /usr/include/kodi/addon-instance/Inputstream.h:2032
    xbmc#9 0x55fb294688a4 in CDVDDemuxClient::Read() (/usr/lib/kodi/kodi.bin+0xc978a4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294e869d in CVideoPlayer::ReadPacket(DemuxPacket*&, CDemuxStream*&) (/usr/lib/kodi/kodi.bin+0xd1769d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb294eae22 in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19e22) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#15 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#16 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T57 created by T0 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x55fb298da1a2  (/usr/lib/kodi/kodi.bin+0x11091a2) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#3 0x55fb294e3181 in CVideoPlayer::OpenFile(CFileItem const&, CPlayerOptions const&) (/usr/lib/kodi/kodi.bin+0xd12181) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#4 0x55fb29b5310d in CApplicationPlayer::OpenFile(CFileItem const&, CPlayerOptions const&, CPlayerCoreFactory const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, IPlayerCallback&) (/usr/lib/kodi/kodi.bin+0x138210d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#5 0x55fb29b347ca in CApplication::PlayFile(CFileItem, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (/usr/lib/kodi/kodi.bin+0x13637ca) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#6 0x55fb29d7ecd8 in KODI::PLAYLIST::CPlayListPlayer::Play(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool) (/usr/lib/kodi/kodi.bin+0x15adcd8) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb29d7f9ef in KODI::PLAYLIST::CPlayListPlayer::Play() (/usr/lib/kodi/kodi.bin+0x15ae9ef) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb29d8ae07 in KODI::PLAYLIST::CPlayListPlayer::OnApplicationMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x15b9e07) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb2994f9b5 in KODI::MESSAGING::CApplicationMessenger::ProcessMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x117e9b5) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb2994fb85 in KODI::MESSAGING::CApplicationMessenger::ProcessMessages() (/usr/lib/kodi/kodi.bin+0x117eb85) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb29b387dc in CApplication::Process() (/usr/lib/kodi/kodi.bin+0x13677dc) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb29b340cb in CApplication::Run() (/usr/lib/kodi/kodi.bin+0x13630cb) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb291ef38f in main (/usr/lib/kodi/kodi.bin+0xa1e38f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe459227740  (/usr/lib/libc.so.6+0x27740) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe459227878 in __libc_start_main (/usr/lib/libc.so.6+0x27878) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x55fb29250154 in _start (/usr/lib/kodi/kodi.bin+0xa7f154) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)

SUMMARY: AddressSanitizer: heap-use-after-free /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182 in CFragmentedSampleReader::ReadSample()
Shadow bytes around the buggy address:
  0x7d0453ac2080: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x7d0453ac2100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7d0453ac2180: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
  0x7d0453ac2200: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2280: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x7d0453ac2300: fd fd fd fd fd fd[fd]fd fd fd fd fd fa fa fa fa
  0x7d0453ac2380: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2400: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x7d0453ac2480: fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa
  0x7d0453ac2500: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==219283==ABORTING
dobo90 added a commit to dobo90/inputstream.adaptive that referenced this pull request Sep 29, 2026
Fixes following sanitizer report:
=================================================================
==219283==ERROR: AddressSanitizer: heap-use-after-free on address 0x7d0453ac2330 at pc 0x7be408843f2d bp 0x7be40277dbf0 sp 0x7be40277dbe0
READ of size 8 at 0x7d0453ac2330 thread T64
    #0 0x7be408843f2c in std::__shared_ptr<AP4_CencSampleDecrypter, (__gnu_cxx::_Lock_policy)2>::operator bool() const /usr/include/c++/16.1.1/bits/shared_ptr_base.h:1756
    #1 0x7be40883c045 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182
    xbmc#2 0x7be408619596 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#3 0x7be408618c5c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#4 0x7be408618882 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#5 0x7be408618021 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#6 0x7be408617c60 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#7 0x7be408617899 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#8 0x7be4086169d9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#9 0x7be408618d7b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#10 0x7be40861892f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#11 0x7be408618204 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#12 0x7be408617cdc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#13 0x55fb298d6655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe45929d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe45929d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x7be4085ff288 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#17 0x7be4085ff288 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#18 0x7be4085f5d1f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#19 0x7be408616b32 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#20 0x7be408602d73 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#21 0x7be4085fba83 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba83) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#22 0x7be408613821 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#23 0x7be408612f63 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f63) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#24 0x7be408611bbe in std::_Function_handler<void (), UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}>::_M_invoke(std::_Any_data const&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa11bbe) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#25 0x7be40888d1d1 in std::function<void ()>::operator()() const /usr/include/c++/16.1.1/bits/std_function.h:581
    xbmc#26 0x7be40888c4cb in UTILS::THREAD::ThreadPool::Executor::Run() /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:70
    xbmc#27 0x7be40888f5da in void std::__invoke_impl<void, void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(std::__invoke_memfun_deref, void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#28 0x7be40888f4c8 in std::__invoke_result<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>::type std::__invoke<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#29 0x7be40888f44a in void std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/include/c++/16.1.1/bits/std_thread.h:303
    xbmc#30 0x7be40888f403 in std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::operator()() /usr/include/c++/16.1.1/bits/std_thread.h:310
    xbmc#31 0x7be40888f3e7 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> > >::_M_run() /usr/include/c++/16.1.1/bits/std_thread.h:255
    xbmc#32 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#33 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#34 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#35 0x7fe45931d21b  (/usr/lib/libc.so.6+0x11d21b) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

0x7d0453ac2330 is located 240 bytes inside of 288-byte region [0x7d0453ac2240,0x7d0453ac2360)
freed by thread T57 here:
    #0 0x7fe45c12e4c1 in operator delete(void*, unsigned long) (/usr/lib/libasan.so+0x12e4c1) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be40883b3be in CFragmentedSampleReader::~CFragmentedSampleReader() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:62
    xbmc#2 0x7be40863ad02 in std::default_delete<ISampleReader>::operator()(ISampleReader*) const /usr/include/c++/16.1.1/bits/unique_ptr.h:92
    xbmc#3 0x7be4086be093 in std::__uniq_ptr_impl<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:204
    xbmc#4 0x7be4086bd915 in std::unique_ptr<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:511
    xbmc#5 0x7be4086bd1ec in SESSION::CStream::UnlinkStream() /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:114
    xbmc#6 0x7be4085ed98b in CInputStreamAdaptive::EnableStream(int, bool) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:157
    xbmc#7 0x7be4085f9f3f in kodi::addon::CInstanceInputStream::ADDON_EnableStream(AddonInstance_InputStream const*, int, bool) /usr/include/kodi/addon-instance/Inputstream.h:2006
    xbmc#8 0x55fb2953d0bd  (/usr/lib/kodi/kodi.bin+0xd6c0bd) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294ecf1f in CVideoPlayer::OnExit() (/usr/lib/kodi/kodi.bin+0xd1bf1f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb298da2f7 in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092f7) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#13 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#14 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

previously allocated by thread T57 here:
    #0 0x7fe45c12d341 in operator new(unsigned long) (/usr/lib/libasan.so+0x12d341) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be4088442da in std::__detail::_MakeUniq<CFragmentedSampleReader>::__single_object std::make_unique<CFragmentedSampleReader, std::shared_ptr<CLinearReader>&, AP4_Track*&>(std::shared_ptr<CLinearReader>&, AP4_Track*&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#2 0x7be40883d940 in CFragmentedSampleReader::CreateReaderByTrack() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:319
    xbmc#3 0x7be4086bcc85 in SESSION::CStream::LinkStream(std::shared_ptr<SESSION::CStream>, int) /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:78
    xbmc#4 0x7be4085edebf in CInputStreamAdaptive::OpenStream(int) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:285
    xbmc#5 0x7be4085fa046 in kodi::addon::CInstanceInputStream::ADDON_OpenStream(AddonInstance_InputStream const*, int) /usr/include/kodi/addon-instance/Inputstream.h:2012
    xbmc#6 0x55fb29468dac in CDVDDemuxClient::OpenStream(int) (/usr/lib/kodi/kodi.bin+0xc97dac) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb294f5589 in CVideoPlayer::OpenStream(CCurrentStream&, long, int, int, bool) (/usr/lib/kodi/kodi.bin+0xd24589) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb294e7b0a in CVideoPlayer::OpenDefaultStreams(bool) (/usr/lib/kodi/kodi.bin+0xd16b0a) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294e91f4 in CVideoPlayer::Prepare() (/usr/lib/kodi/kodi.bin+0xd181f4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294eab6c in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19b6c) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#14 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#15 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T64 created by T57 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x7be40888d038 in std::thread::thread<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*, void>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/std_thread.h:175
    xbmc#3 0x7be40888c27e in UTILS::THREAD::ThreadPool::Executor::Executor(UTILS::THREAD::ThreadPool&) /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:55
    xbmc#4 0x7be408602f94 in std::__detail::_MakeUniq<UTILS::THREAD::ThreadPool::Executor>::__single_object std::make_unique<UTILS::THREAD::ThreadPool::Executor, UTILS::THREAD::ThreadPool&>(UTILS::THREAD::ThreadPool&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#5 0x7be4085fbf72 in auto UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fbf72) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#6 0x7be4085fc3dc in ISampleReader::ReadSampleAsync() (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fc3dc) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#7 0x7be4085ef0b8 in CInputStreamAdaptive::DemuxRead() /home/dobo/kodi/inputstream.adaptive/src/main.cpp:381
    xbmc#8 0x7be4085fa449 in kodi::addon::CInstanceInputStream::ADDON_DemuxRead(AddonInstance_InputStream const*) /usr/include/kodi/addon-instance/Inputstream.h:2032
    xbmc#9 0x55fb294688a4 in CDVDDemuxClient::Read() (/usr/lib/kodi/kodi.bin+0xc978a4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294e869d in CVideoPlayer::ReadPacket(DemuxPacket*&, CDemuxStream*&) (/usr/lib/kodi/kodi.bin+0xd1769d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb294eae22 in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19e22) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#15 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#16 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T57 created by T0 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x55fb298da1a2  (/usr/lib/kodi/kodi.bin+0x11091a2) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#3 0x55fb294e3181 in CVideoPlayer::OpenFile(CFileItem const&, CPlayerOptions const&) (/usr/lib/kodi/kodi.bin+0xd12181) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#4 0x55fb29b5310d in CApplicationPlayer::OpenFile(CFileItem const&, CPlayerOptions const&, CPlayerCoreFactory const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, IPlayerCallback&) (/usr/lib/kodi/kodi.bin+0x138210d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#5 0x55fb29b347ca in CApplication::PlayFile(CFileItem, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (/usr/lib/kodi/kodi.bin+0x13637ca) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#6 0x55fb29d7ecd8 in KODI::PLAYLIST::CPlayListPlayer::Play(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool) (/usr/lib/kodi/kodi.bin+0x15adcd8) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb29d7f9ef in KODI::PLAYLIST::CPlayListPlayer::Play() (/usr/lib/kodi/kodi.bin+0x15ae9ef) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb29d8ae07 in KODI::PLAYLIST::CPlayListPlayer::OnApplicationMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x15b9e07) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb2994f9b5 in KODI::MESSAGING::CApplicationMessenger::ProcessMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x117e9b5) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb2994fb85 in KODI::MESSAGING::CApplicationMessenger::ProcessMessages() (/usr/lib/kodi/kodi.bin+0x117eb85) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb29b387dc in CApplication::Process() (/usr/lib/kodi/kodi.bin+0x13677dc) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb29b340cb in CApplication::Run() (/usr/lib/kodi/kodi.bin+0x13630cb) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb291ef38f in main (/usr/lib/kodi/kodi.bin+0xa1e38f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe459227740  (/usr/lib/libc.so.6+0x27740) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe459227878 in __libc_start_main (/usr/lib/libc.so.6+0x27878) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x55fb29250154 in _start (/usr/lib/kodi/kodi.bin+0xa7f154) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)

SUMMARY: AddressSanitizer: heap-use-after-free /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182 in CFragmentedSampleReader::ReadSample()
Shadow bytes around the buggy address:
  0x7d0453ac2080: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x7d0453ac2100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7d0453ac2180: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
  0x7d0453ac2200: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2280: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x7d0453ac2300: fd fd fd fd fd fd[fd]fd fd fd fd fd fa fa fa fa
  0x7d0453ac2380: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2400: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x7d0453ac2480: fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa
  0x7d0453ac2500: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==219283==ABORTING
dobo90 added a commit to dobo90/inputstream.adaptive that referenced this pull request Nov 3, 2026
Fixes following sanitizer report:
=================================================================
==219283==ERROR: AddressSanitizer: heap-use-after-free on address 0x7d0453ac2330 at pc 0x7be408843f2d bp 0x7be40277dbf0 sp 0x7be40277dbe0
READ of size 8 at 0x7d0453ac2330 thread T64
    #0 0x7be408843f2c in std::__shared_ptr<AP4_CencSampleDecrypter, (__gnu_cxx::_Lock_policy)2>::operator bool() const /usr/include/c++/16.1.1/bits/shared_ptr_base.h:1756
    #1 0x7be40883c045 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182
    xbmc#2 0x7be408619596 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#3 0x7be408618c5c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#4 0x7be408618882 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#5 0x7be408618021 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#6 0x7be408617c60 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#7 0x7be408617899 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#8 0x7be4086169d9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#9 0x7be408618d7b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#10 0x7be40861892f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#11 0x7be408618204 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#12 0x7be408617cdc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#13 0x55fb298d6655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe45929d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe45929d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x7be4085ff288 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#17 0x7be4085ff288 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#18 0x7be4085f5d1f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#19 0x7be408616b32 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#20 0x7be408602d73 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#21 0x7be4085fba83 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba83) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#22 0x7be408613821 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#23 0x7be408612f63 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f63) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#24 0x7be408611bbe in std::_Function_handler<void (), UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}>::_M_invoke(std::_Any_data const&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa11bbe) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#25 0x7be40888d1d1 in std::function<void ()>::operator()() const /usr/include/c++/16.1.1/bits/std_function.h:581
    xbmc#26 0x7be40888c4cb in UTILS::THREAD::ThreadPool::Executor::Run() /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:70
    xbmc#27 0x7be40888f5da in void std::__invoke_impl<void, void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(std::__invoke_memfun_deref, void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#28 0x7be40888f4c8 in std::__invoke_result<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>::type std::__invoke<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#29 0x7be40888f44a in void std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/include/c++/16.1.1/bits/std_thread.h:303
    xbmc#30 0x7be40888f403 in std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::operator()() /usr/include/c++/16.1.1/bits/std_thread.h:310
    xbmc#31 0x7be40888f3e7 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> > >::_M_run() /usr/include/c++/16.1.1/bits/std_thread.h:255
    xbmc#32 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#33 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#34 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#35 0x7fe45931d21b  (/usr/lib/libc.so.6+0x11d21b) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

0x7d0453ac2330 is located 240 bytes inside of 288-byte region [0x7d0453ac2240,0x7d0453ac2360)
freed by thread T57 here:
    #0 0x7fe45c12e4c1 in operator delete(void*, unsigned long) (/usr/lib/libasan.so+0x12e4c1) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be40883b3be in CFragmentedSampleReader::~CFragmentedSampleReader() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:62
    xbmc#2 0x7be40863ad02 in std::default_delete<ISampleReader>::operator()(ISampleReader*) const /usr/include/c++/16.1.1/bits/unique_ptr.h:92
    xbmc#3 0x7be4086be093 in std::__uniq_ptr_impl<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:204
    xbmc#4 0x7be4086bd915 in std::unique_ptr<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:511
    xbmc#5 0x7be4086bd1ec in SESSION::CStream::UnlinkStream() /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:114
    xbmc#6 0x7be4085ed98b in CInputStreamAdaptive::EnableStream(int, bool) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:157
    xbmc#7 0x7be4085f9f3f in kodi::addon::CInstanceInputStream::ADDON_EnableStream(AddonInstance_InputStream const*, int, bool) /usr/include/kodi/addon-instance/Inputstream.h:2006
    xbmc#8 0x55fb2953d0bd  (/usr/lib/kodi/kodi.bin+0xd6c0bd) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294ecf1f in CVideoPlayer::OnExit() (/usr/lib/kodi/kodi.bin+0xd1bf1f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb298da2f7 in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092f7) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#13 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#14 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

previously allocated by thread T57 here:
    #0 0x7fe45c12d341 in operator new(unsigned long) (/usr/lib/libasan.so+0x12d341) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be4088442da in std::__detail::_MakeUniq<CFragmentedSampleReader>::__single_object std::make_unique<CFragmentedSampleReader, std::shared_ptr<CLinearReader>&, AP4_Track*&>(std::shared_ptr<CLinearReader>&, AP4_Track*&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#2 0x7be40883d940 in CFragmentedSampleReader::CreateReaderByTrack() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:319
    xbmc#3 0x7be4086bcc85 in SESSION::CStream::LinkStream(std::shared_ptr<SESSION::CStream>, int) /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:78
    xbmc#4 0x7be4085edebf in CInputStreamAdaptive::OpenStream(int) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:285
    xbmc#5 0x7be4085fa046 in kodi::addon::CInstanceInputStream::ADDON_OpenStream(AddonInstance_InputStream const*, int) /usr/include/kodi/addon-instance/Inputstream.h:2012
    xbmc#6 0x55fb29468dac in CDVDDemuxClient::OpenStream(int) (/usr/lib/kodi/kodi.bin+0xc97dac) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb294f5589 in CVideoPlayer::OpenStream(CCurrentStream&, long, int, int, bool) (/usr/lib/kodi/kodi.bin+0xd24589) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb294e7b0a in CVideoPlayer::OpenDefaultStreams(bool) (/usr/lib/kodi/kodi.bin+0xd16b0a) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294e91f4 in CVideoPlayer::Prepare() (/usr/lib/kodi/kodi.bin+0xd181f4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294eab6c in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19b6c) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#14 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#15 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T64 created by T57 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x7be40888d038 in std::thread::thread<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*, void>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/std_thread.h:175
    xbmc#3 0x7be40888c27e in UTILS::THREAD::ThreadPool::Executor::Executor(UTILS::THREAD::ThreadPool&) /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:55
    xbmc#4 0x7be408602f94 in std::__detail::_MakeUniq<UTILS::THREAD::ThreadPool::Executor>::__single_object std::make_unique<UTILS::THREAD::ThreadPool::Executor, UTILS::THREAD::ThreadPool&>(UTILS::THREAD::ThreadPool&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#5 0x7be4085fbf72 in auto UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fbf72) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#6 0x7be4085fc3dc in ISampleReader::ReadSampleAsync() (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fc3dc) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#7 0x7be4085ef0b8 in CInputStreamAdaptive::DemuxRead() /home/dobo/kodi/inputstream.adaptive/src/main.cpp:381
    xbmc#8 0x7be4085fa449 in kodi::addon::CInstanceInputStream::ADDON_DemuxRead(AddonInstance_InputStream const*) /usr/include/kodi/addon-instance/Inputstream.h:2032
    xbmc#9 0x55fb294688a4 in CDVDDemuxClient::Read() (/usr/lib/kodi/kodi.bin+0xc978a4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294e869d in CVideoPlayer::ReadPacket(DemuxPacket*&, CDemuxStream*&) (/usr/lib/kodi/kodi.bin+0xd1769d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb294eae22 in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19e22) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#15 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#16 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T57 created by T0 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x55fb298da1a2  (/usr/lib/kodi/kodi.bin+0x11091a2) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#3 0x55fb294e3181 in CVideoPlayer::OpenFile(CFileItem const&, CPlayerOptions const&) (/usr/lib/kodi/kodi.bin+0xd12181) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#4 0x55fb29b5310d in CApplicationPlayer::OpenFile(CFileItem const&, CPlayerOptions const&, CPlayerCoreFactory const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, IPlayerCallback&) (/usr/lib/kodi/kodi.bin+0x138210d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#5 0x55fb29b347ca in CApplication::PlayFile(CFileItem, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (/usr/lib/kodi/kodi.bin+0x13637ca) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#6 0x55fb29d7ecd8 in KODI::PLAYLIST::CPlayListPlayer::Play(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool) (/usr/lib/kodi/kodi.bin+0x15adcd8) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb29d7f9ef in KODI::PLAYLIST::CPlayListPlayer::Play() (/usr/lib/kodi/kodi.bin+0x15ae9ef) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb29d8ae07 in KODI::PLAYLIST::CPlayListPlayer::OnApplicationMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x15b9e07) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb2994f9b5 in KODI::MESSAGING::CApplicationMessenger::ProcessMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x117e9b5) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb2994fb85 in KODI::MESSAGING::CApplicationMessenger::ProcessMessages() (/usr/lib/kodi/kodi.bin+0x117eb85) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb29b387dc in CApplication::Process() (/usr/lib/kodi/kodi.bin+0x13677dc) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb29b340cb in CApplication::Run() (/usr/lib/kodi/kodi.bin+0x13630cb) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb291ef38f in main (/usr/lib/kodi/kodi.bin+0xa1e38f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe459227740  (/usr/lib/libc.so.6+0x27740) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe459227878 in __libc_start_main (/usr/lib/libc.so.6+0x27878) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x55fb29250154 in _start (/usr/lib/kodi/kodi.bin+0xa7f154) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)

SUMMARY: AddressSanitizer: heap-use-after-free /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182 in CFragmentedSampleReader::ReadSample()
Shadow bytes around the buggy address:
  0x7d0453ac2080: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x7d0453ac2100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7d0453ac2180: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
  0x7d0453ac2200: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2280: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x7d0453ac2300: fd fd fd fd fd fd[fd]fd fd fd fd fd fa fa fa fa
  0x7d0453ac2380: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2400: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x7d0453ac2480: fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa
  0x7d0453ac2500: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==219283==ABORTING
dobo90 added a commit to dobo90/inputstream.adaptive that referenced this pull request Nov 3, 2026
Fixes following sanitizer report:
=================================================================
==219283==ERROR: AddressSanitizer: heap-use-after-free on address 0x7d0453ac2330 at pc 0x7be408843f2d bp 0x7be40277dbf0 sp 0x7be40277dbe0
READ of size 8 at 0x7d0453ac2330 thread T64
    #0 0x7be408843f2c in std::__shared_ptr<AP4_CencSampleDecrypter, (__gnu_cxx::_Lock_policy)2>::operator bool() const /usr/include/c++/16.1.1/bits/shared_ptr_base.h:1756
    #1 0x7be40883c045 in CFragmentedSampleReader::ReadSample() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182
    xbmc#2 0x7be408619596 in int std::__invoke_impl<int, int (ISampleReader::*&)(), ISampleReader*&>(std::__invoke_memfun_deref, int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#3 0x7be408618c5c in std::__invoke_result<int (ISampleReader::*&)(), ISampleReader*&>::type std::__invoke<int (ISampleReader::*&)(), ISampleReader*&>(int (ISampleReader::*&)(), ISampleReader*&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#4 0x7be408618882 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::__call<int, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/include/c++/16.1.1/functional:541
    xbmc#5 0x7be408618021 in int std::_Bind<int (ISampleReader::*(ISampleReader*))()>::operator()<, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&, std::_Bind<int (ISampleReader::*(ISampleReader*))()>, 0, int>(this std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/functional:645
    xbmc#6 0x7be408617c60 in int std::__invoke_impl<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::__invoke_other, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#7 0x7be408617899 in std::enable_if<is_invocable_r_v<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>, int>::type std::__invoke_r<int, std::_Bind<int (ISampleReader::*(ISampleReader*))()>&>(std::_Bind<int (ISampleReader::*(ISampleReader*))()>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#8 0x7be4086169d9 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/16.1.1/future:1517
    xbmc#9 0x7be408618d7b in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>::operator()() const /usr/include/c++/16.1.1/future:1419
    xbmc#10 0x7be40861892f in std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#11 0x7be408618204 in std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int>&) /usr/include/c++/16.1.1/bits/invoke.h:116
    xbmc#12 0x7be408617cdc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<int>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run()::{lambda()#1}, int> >::_M_invoke(std::_Any_data const&) /usr/include/c++/16.1.1/bits/std_function.h:296
    xbmc#13 0x55fb298d6655 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (/usr/lib/kodi/kodi.bin+0x1105655) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe45929d8fb  (/usr/lib/libc.so.6+0x9d8fb) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe45929d978 in pthread_once (/usr/lib/libc.so.6+0x9d978) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x7be4085ff288 in __gthread_once(int*, void (*)()) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:746
    xbmc#17 0x7be4085ff288 in void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/16.1.1/mutex:923
    xbmc#18 0x7be4085f5d1f in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/16.1.1/future:438
    xbmc#19 0x7be408616b32 in std::__future_base::_Task_state<std::_Bind<int (ISampleReader::*(ISampleReader*))()>, std::allocator<int>, int ()>::_M_run() /usr/include/c++/16.1.1/future:1520
    xbmc#20 0x7be408602d73 in std::packaged_task<int ()>::operator()() /usr/include/c++/16.1.1/future:1643
    xbmc#21 0x7be4085fba83 in UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}::operator()() const (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fba83) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#22 0x7be408613821 in void std::__invoke_impl<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(std::__invoke_other, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) /usr/include/c++/16.1.1/bits/invoke.h:63
    xbmc#23 0x7be408612f63 in std::enable_if<is_invocable_r_v<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>, void>::type std::__invoke_r<void, UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&>(UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa12f63) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#24 0x7be408611bbe in std::_Function_handler<void (), UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&)::{lambda()#1}>::_M_invoke(std::_Any_data const&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0xa11bbe) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#25 0x7be40888d1d1 in std::function<void ()>::operator()() const /usr/include/c++/16.1.1/bits/std_function.h:581
    xbmc#26 0x7be40888c4cb in UTILS::THREAD::ThreadPool::Executor::Run() /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:70
    xbmc#27 0x7be40888f5da in void std::__invoke_impl<void, void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(std::__invoke_memfun_deref, void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:76
    xbmc#28 0x7be40888f4c8 in std::__invoke_result<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>::type std::__invoke<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/invoke.h:98
    xbmc#29 0x7be40888f44a in void std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/include/c++/16.1.1/bits/std_thread.h:303
    xbmc#30 0x7be40888f403 in std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> >::operator()() /usr/include/c++/16.1.1/bits/std_thread.h:310
    xbmc#31 0x7be40888f3e7 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*> > >::_M_run() /usr/include/c++/16.1.1/bits/std_thread.h:255
    xbmc#32 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#33 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#34 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#35 0x7fe45931d21b  (/usr/lib/libc.so.6+0x11d21b) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

0x7d0453ac2330 is located 240 bytes inside of 288-byte region [0x7d0453ac2240,0x7d0453ac2360)
freed by thread T57 here:
    #0 0x7fe45c12e4c1 in operator delete(void*, unsigned long) (/usr/lib/libasan.so+0x12e4c1) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be40883b3be in CFragmentedSampleReader::~CFragmentedSampleReader() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:62
    xbmc#2 0x7be40863ad02 in std::default_delete<ISampleReader>::operator()(ISampleReader*) const /usr/include/c++/16.1.1/bits/unique_ptr.h:92
    xbmc#3 0x7be4086be093 in std::__uniq_ptr_impl<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:204
    xbmc#4 0x7be4086bd915 in std::unique_ptr<ISampleReader, std::default_delete<ISampleReader> >::reset(ISampleReader*) /usr/include/c++/16.1.1/bits/unique_ptr.h:511
    xbmc#5 0x7be4086bd1ec in SESSION::CStream::UnlinkStream() /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:114
    xbmc#6 0x7be4085ed98b in CInputStreamAdaptive::EnableStream(int, bool) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:157
    xbmc#7 0x7be4085f9f3f in kodi::addon::CInstanceInputStream::ADDON_EnableStream(AddonInstance_InputStream const*, int, bool) /usr/include/kodi/addon-instance/Inputstream.h:2006
    xbmc#8 0x55fb2953d0bd  (/usr/lib/kodi/kodi.bin+0xd6c0bd) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294ecf1f in CVideoPlayer::OnExit() (/usr/lib/kodi/kodi.bin+0xd1bf1f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb298da2f7 in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092f7) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#13 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#14 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

previously allocated by thread T57 here:
    #0 0x7fe45c12d341 in operator new(unsigned long) (/usr/lib/libasan.so+0x12d341) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7be4088442da in std::__detail::_MakeUniq<CFragmentedSampleReader>::__single_object std::make_unique<CFragmentedSampleReader, std::shared_ptr<CLinearReader>&, AP4_Track*&>(std::shared_ptr<CLinearReader>&, AP4_Track*&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#2 0x7be40883d940 in CFragmentedSampleReader::CreateReaderByTrack() /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:319
    xbmc#3 0x7be4086bcc85 in SESSION::CStream::LinkStream(std::shared_ptr<SESSION::CStream>, int) /home/dobo/kodi/inputstream.adaptive/src/Stream.cpp:78
    xbmc#4 0x7be4085edebf in CInputStreamAdaptive::OpenStream(int) /home/dobo/kodi/inputstream.adaptive/src/main.cpp:285
    xbmc#5 0x7be4085fa046 in kodi::addon::CInstanceInputStream::ADDON_OpenStream(AddonInstance_InputStream const*, int) /usr/include/kodi/addon-instance/Inputstream.h:2012
    xbmc#6 0x55fb29468dac in CDVDDemuxClient::OpenStream(int) (/usr/lib/kodi/kodi.bin+0xc97dac) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb294f5589 in CVideoPlayer::OpenStream(CCurrentStream&, long, int, int, bool) (/usr/lib/kodi/kodi.bin+0xd24589) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb294e7b0a in CVideoPlayer::OpenDefaultStreams(bool) (/usr/lib/kodi/kodi.bin+0xd16b0a) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb294e91f4 in CVideoPlayer::Prepare() (/usr/lib/kodi/kodi.bin+0xd181f4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294eab6c in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19b6c) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#14 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#15 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T64 created by T57 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x7be40888d038 in std::thread::thread<void (UTILS::THREAD::ThreadPool::Executor::*)(), UTILS::THREAD::ThreadPool::Executor*, void>(void (UTILS::THREAD::ThreadPool::Executor::*&&)(), UTILS::THREAD::ThreadPool::Executor*&&) /usr/include/c++/16.1.1/bits/std_thread.h:175
    xbmc#3 0x7be40888c27e in UTILS::THREAD::ThreadPool::Executor::Executor(UTILS::THREAD::ThreadPool&) /home/dobo/kodi/inputstream.adaptive/src/utils/ThreadPool.cpp:55
    xbmc#4 0x7be408602f94 in std::__detail::_MakeUniq<UTILS::THREAD::ThreadPool::Executor>::__single_object std::make_unique<UTILS::THREAD::ThreadPool::Executor, UTILS::THREAD::ThreadPool&>(UTILS::THREAD::ThreadPool&) /usr/include/c++/16.1.1/bits/unique_ptr.h:1086
    xbmc#5 0x7be4085fbf72 in auto UTILS::THREAD::ThreadPool::Execute<int (ISampleReader::*)(), ISampleReader*>(int (ISampleReader::*&&)(), ISampleReader*&&) (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fbf72) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#6 0x7be4085fc3dc in ISampleReader::ReadSampleAsync() (/usr/lib/kodi/addons/inputstream.adaptive/inputstream.adaptive.so.22.3.10+0x9fc3dc) (BuildId: ce7c73d104d6d4f3d02b9148a58dfce1b1399311)
    xbmc#7 0x7be4085ef0b8 in CInputStreamAdaptive::DemuxRead() /home/dobo/kodi/inputstream.adaptive/src/main.cpp:381
    xbmc#8 0x7be4085fa449 in kodi::addon::CInstanceInputStream::ADDON_DemuxRead(AddonInstance_InputStream const*) /usr/include/kodi/addon-instance/Inputstream.h:2032
    xbmc#9 0x55fb294688a4 in CDVDDemuxClient::Read() (/usr/lib/kodi/kodi.bin+0xc978a4) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb294e869d in CVideoPlayer::ReadPacket(DemuxPacket*&, CDemuxStream*&) (/usr/lib/kodi/kodi.bin+0xd1769d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb294eae22 in CVideoPlayer::Process() (/usr/lib/kodi/kodi.bin+0xd19e22) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb298da2ee in CThread::Action() (/usr/lib/kodi/kodi.bin+0x11092ee) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb298df618  (/usr/lib/kodi/kodi.bin+0x110e618) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe4596eb918  (/usr/lib/libstdc++.so.6+0xeb918) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#15 0x7fe45c0618d8  (/usr/lib/libasan.so+0x618d8) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    xbmc#16 0x7fe4592981b8  (/usr/lib/libc.so.6+0x981b8) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)

Thread T57 created by T0 here:
    #0 0x7fe45c122774 in pthread_create (/usr/lib/libasan.so+0x122774) (BuildId: ee5fbab73143ab257a66a33afe0f038a4af7a74e)
    #1 0x7fe4596eba21 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/libstdc++.so.6+0xeba21) (BuildId: 4749d5ce79ac21b5e837c001c58e342b35197e4b)
    xbmc#2 0x55fb298da1a2  (/usr/lib/kodi/kodi.bin+0x11091a2) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#3 0x55fb294e3181 in CVideoPlayer::OpenFile(CFileItem const&, CPlayerOptions const&) (/usr/lib/kodi/kodi.bin+0xd12181) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#4 0x55fb29b5310d in CApplicationPlayer::OpenFile(CFileItem const&, CPlayerOptions const&, CPlayerCoreFactory const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, IPlayerCallback&) (/usr/lib/kodi/kodi.bin+0x138210d) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#5 0x55fb29b347ca in CApplication::PlayFile(CFileItem, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (/usr/lib/kodi/kodi.bin+0x13637ca) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#6 0x55fb29d7ecd8 in KODI::PLAYLIST::CPlayListPlayer::Play(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool) (/usr/lib/kodi/kodi.bin+0x15adcd8) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#7 0x55fb29d7f9ef in KODI::PLAYLIST::CPlayListPlayer::Play() (/usr/lib/kodi/kodi.bin+0x15ae9ef) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#8 0x55fb29d8ae07 in KODI::PLAYLIST::CPlayListPlayer::OnApplicationMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x15b9e07) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#9 0x55fb2994f9b5 in KODI::MESSAGING::CApplicationMessenger::ProcessMessage(KODI::MESSAGING::ThreadMessage*) (/usr/lib/kodi/kodi.bin+0x117e9b5) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#10 0x55fb2994fb85 in KODI::MESSAGING::CApplicationMessenger::ProcessMessages() (/usr/lib/kodi/kodi.bin+0x117eb85) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#11 0x55fb29b387dc in CApplication::Process() (/usr/lib/kodi/kodi.bin+0x13677dc) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#12 0x55fb29b340cb in CApplication::Run() (/usr/lib/kodi/kodi.bin+0x13630cb) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#13 0x55fb291ef38f in main (/usr/lib/kodi/kodi.bin+0xa1e38f) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)
    xbmc#14 0x7fe459227740  (/usr/lib/libc.so.6+0x27740) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#15 0x7fe459227878 in __libc_start_main (/usr/lib/libc.so.6+0x27878) (BuildId: 020d6f7c33b2413f4fe10814c4729dce1387f049)
    xbmc#16 0x55fb29250154 in _start (/usr/lib/kodi/kodi.bin+0xa7f154) (BuildId: 71f55ec6f5d4c4b2e18830e9d6568f84c558efc1)

SUMMARY: AddressSanitizer: heap-use-after-free /home/dobo/kodi/inputstream.adaptive/src/samplereader/FragmentedSampleReader.cpp:182 in CFragmentedSampleReader::ReadSample()
Shadow bytes around the buggy address:
  0x7d0453ac2080: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x7d0453ac2100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7d0453ac2180: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
  0x7d0453ac2200: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2280: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x7d0453ac2300: fd fd fd fd fd fd[fd]fd fd fd fd fd fa fa fa fa
  0x7d0453ac2380: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2400: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x7d0453ac2480: fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa
  0x7d0453ac2500: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x7d0453ac2580: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==219283==ABORTING
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Pass mpd URL custom headers to actual video files?

5 participants