# Mp3tag shut down after viewing multiple songs

**URL:** https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713
**Category:** Fixed Bugs
**Tags:** bug-fixed
**Created:** [April 7, 2021, 11:06pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713 "2021-04-07T23:06:46Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [April 9, 2021, 1:53pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/21 "2021-04-09T13:53:08Z")

</div>

Yes, I also see that — thanks for looking into it. But there are others where it's happening when strings get deallocated. It's really mysterious.

---

<div class="post-metadata">

### Author: ![Prilkop](https://community.mp3tag.de/user_avatar/community.mp3tag.de/prilkop/32/9171_2.png) [@Prilkop](https://community.mp3tag.de/u/Prilkop)
#### Post date: [April 9, 2021, 1:55pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/22 "2021-04-09T13:55:41Z")

</div>

So I guess something corrupts the heap beforehand and then it crashes there...

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [April 9, 2021, 2:03pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/23 "2021-04-09T14:03:23Z")

</div>

Can you check again with this internal version and send any crash dumps along my way 😅

[https://download.mp3tag.de/support/F0C63CE4-E3BD-4EB0-A90C-E1BF6B710B21-3631/mp3tagv306c1setup.exe](https://download.mp3tag.de/support/F0C63CE4-E3BD-4EB0-A90C-E1BF6B710B21-3631/mp3tagv306c1setup.exe)

---

<div class="post-metadata">

### Author: ![MDNL](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/f9ae1b/32.png) [@MDNL](https://community.mp3tag.de/u/MDNL)
#### Post date: [April 9, 2021, 2:50pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/24 "2021-04-09T14:50:08Z")

</div>

thanks, I reproduced the bug on the new version [dmp.zip](https://community.mp3tag.de/uploads/short-url/6vkio3akvOVRlp9FXyxehgi3QHZ.zip) (503.1 KB)

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [April 9, 2021, 2:58pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/25 "2021-04-09T14:58:31Z")

</div>

OK, thanks. You're probably already an expert in reproducing this: can you describe the minimal steps that you're doing to trigger this?

---

<div class="post-metadata">

### Author: ![MDNL](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/f9ae1b/32.png) [@MDNL](https://community.mp3tag.de/u/MDNL)
#### Post date: [April 9, 2021, 3:06pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/26 "2021-04-09T15:06:02Z")

</div>

Lol yes

Example #1-

1. Press right click on folder
2. Select "Mp3tag" button in options window
3. Press right click on first song
4. Select "Extended Tags..." button
5. Press "\> \>" button multiple times until crash might occur (usually around song 6/7/10).

Example #2-

1. Select all songs in folder
2. Press right click on songs
3. Select "Mp3tag" button in options window
4. Press right click on song in the middle of the list
5. Select "Extended Tags..." button
6. Press "\< \<" button multiple times until crash might occur (usually once getting closer to the beginning).

Please let me know if it helps, or I should get a screen recording.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [April 9, 2021, 3:10pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/27 "2021-04-09T15:10:25Z")

</div>

This helps, thank you! Except that it doesn't crash here 🙂 I'll continue trying...

---

<div class="post-metadata">

### Author: ![Prilkop](https://community.mp3tag.de/user_avatar/community.mp3tag.de/prilkop/32/9171_2.png) [@Prilkop](https://community.mp3tag.de/u/Prilkop)
#### Post date: [April 9, 2021, 4:04pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/28 "2021-04-09T16:04:39Z")

</div>

Okay, apparently there was an important difference between yesterday and today.  
Yesterday I used my laptop and today I used my home pc.

I just ran v3.06c on my laptop and was able to reproduce the crash and generate a full dump rather than a minidump: [https://www.transfernow.net/dl/20210409ORc1kVbT](https://www.transfernow.net/dl/20210409ORc1kVbT). Hopefully it will help.

---

<div class="post-metadata">

### Author: ![Prilkop](https://community.mp3tag.de/user_avatar/community.mp3tag.de/prilkop/32/9171_2.png) [@Prilkop](https://community.mp3tag.de/u/Prilkop)
#### Post date: [April 10, 2021, 3:52pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/29 "2021-04-10T15:52:23Z")

</div>

Any luck finding the bug? Can I help in any way?

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [April 10, 2021, 4:23pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/30 "2021-04-10T16:23:20Z")

</div>

Unfortunately, no luck in finding the bug. It's crashing when calling the destructor of a certain class, but I don't see how the memory got corrupted in the first place.

Thanks for the full dump! It's the first time I've received something like that and it's a real luxury for debugging 😃

---

<div class="post-metadata">

### Author: ![Prilkop](https://community.mp3tag.de/user_avatar/community.mp3tag.de/prilkop/32/9171_2.png) [@Prilkop](https://community.mp3tag.de/u/Prilkop)
#### Post date: [April 10, 2021, 5:09pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/31 "2021-04-10T17:09:15Z")

</div>

Sure thing!

A tool called GFlags should be able to detect the corruption when it happens. I'll try to run it and see what I can find without symbols or source code. I'll let you know if I find any lead.

---

<div class="post-metadata">

### Author: ![Prilkop](https://community.mp3tag.de/user_avatar/community.mp3tag.de/prilkop/32/9171_2.png) [@Prilkop](https://community.mp3tag.de/u/Prilkop)
#### Post date: [April 10, 2021, 6:58pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/32 "2021-04-10T18:58:33Z")

</div>

I used GFlags, and it seems the corruption does happen when working with paths.

Here is a minidump of the corruption:  
[Mp3tag.exe.7728.zip](https://community.mp3tag.de/uploads/short-url/o1iMEycQluG4q6owUoksfY8ntIB.zip) (239.8 KB)  
If you need a full dump again, let me know.

---

<div class="post-metadata">

### Author: ![Prilkop](https://community.mp3tag.de/user_avatar/community.mp3tag.de/prilkop/32/9171_2.png) [@Prilkop](https://community.mp3tag.de/u/Prilkop)
#### Post date: [April 10, 2021, 7:16pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/33 "2021-04-10T19:16:48Z")

</div>

@Florian, if I'm not mistaken you are calling PathCompactPath with a buffer smaller than MAX\_PATH + 1 characters (see documentation here: [PathCompactPathW function (shlwapi.h) - Win32 apps | Microsoft Docs](https://docs.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-pathcompactpathw)), and in this case (with the specific path and the specific window width) a buffer overflow occurs.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [April 10, 2021, 7:32pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/34 "2021-04-10T19:32:03Z")

</div>

Are you a wizard? 🤯 😇 It's really amazing what you've done here and I'm full of awe regarding your skills.

This is the relevant section, and you're right, the buffer is too small.

```auto
const auto count = ::_tcslen(filePath) + 1;
std::vector<TCHAR> buffer(count);

::_tcscpy_s(buffer.data(), count, filePath);
::PathCompactPath(dc, buffer.data(), windowRect.Width() - textSize.cx);

```

I'll fix right away and upload a new internal version soon.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [April 10, 2021, 8:14pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/35 "2021-04-10T20:14:28Z")

</div>

This is the new internal version containing the fix for the bug you've spotted:

[https://download.mp3tag.de/support/F0C63CE4-E3BD-4EB0-A90C-E1BF6B710B21-3632/mp3tagv306c2setup.exe](https://download.mp3tag.de/support/F0C63CE4-E3BD-4EB0-A90C-E1BF6B710B21-3632/mp3tagv306c2setup.exe)

I'm really curious now 😃

---

<div class="post-metadata">

### Author: ![MDNL](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/f9ae1b/32.png) [@MDNL](https://community.mp3tag.de/u/MDNL)
#### Post date: [April 10, 2021, 8:26pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/36 "2021-04-10T20:26:30Z")

</div>

I tried to reproduce the bug on version 306c2 and it was fixed!  
Thank you so much to everyone who commented, worked and made an effort to resolve this.  
Special thanks to @Prilkop for spotting it!

---

<div class="post-metadata">

### Author: ![Prilkop](https://community.mp3tag.de/user_avatar/community.mp3tag.de/prilkop/32/9171_2.png) [@Prilkop](https://community.mp3tag.de/u/Prilkop)
#### Post date: [April 10, 2021, 8:34pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/37 "2021-04-10T20:34:05Z")

</div>

It isn't reproduced here too.

I think we did it! 😃

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [April 10, 2021, 8:37pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/38 "2021-04-10T20:37:16Z")

</div>

Really cool 🙌 Thank you both for helping with that 🙏

@Prilkop, that's really amazing what you did there. Thanks a lot!

---

<div class="post-metadata">

### Author: ![Prilkop](https://community.mp3tag.de/user_avatar/community.mp3tag.de/prilkop/32/9171_2.png) [@Prilkop](https://community.mp3tag.de/u/Prilkop)
#### Post date: [April 10, 2021, 8:40pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/39 "2021-04-10T20:40:35Z")

</div>

No problem!  
Thank you @Florian for creating and maintaining such a cool and useful tool for such a long time!

Happy to help! 🙂

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [April 11, 2021, 1:38pm UTC](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713/42 "2021-04-11T13:38:03Z")

</div>

I've now fixed that officially with [Mp3tag v3.06d](https://community.mp3tag.de/t/455).

Thank you!

[Previous page](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713.md?page=1)

[Next page](https://community.mp3tag.de/t/mp3tag-shut-down-after-viewing-multiple-songs/52713.md?page=3)
