CD Reader bug?

When I rip an audio CD using juce CD reader, the wavedata of the last track is something wrong.
The end of the data is missing or added wrong data. See the attached image
This problem certainly occurs in Windows. 
It seems that Mac is OK. 
Would fix this problem? 

Thank you.

Wow.. I'm afraid that all my PCs are too modern to actually have a CD drive that I could use to test this!

The CD-reading code is one of the oldest parts of the codebase - I wrote it years ago when CDs were common, and it hasn't been touched since then - it always seemed to work ok.

It'd be very difficult to debug this - there are lots of different handlers in there for different types of SCSI controller, and your device could be using any of them. It'd help if you could look in juce_win32_AudioCDReader.cpp at CDDeviceHandle::readAudio() and at least find out which of those ControllerTypeX classes it chooses for your device.

We have tried some drives, they show ;
The internal and external drives are same.
Does this information become the clue?

And it seems that there is also a external drive which juce does not recognize. 

I'm rarely stumped by a problem, but can't really think of anything to suggest about this..

Just having a quick look at the code (which I must have written over ten years ago!), there's a comment at line 1120

                // sometimes the read fails for just the very last couple of blocks, so
                // we'll ignore and errors in the last half-second of the disk..

I vaguely recall that the actual devices just mysteriously failed on those last blocks, and there wasn't anything that could be done about it. Might be the same thing you're seeing. Certainly the fact that the samples in the incorrect block of data are -32768 indicate to me that it's the device driver that's returning those numbers, and not a bug in the juce code that calls it (otherwise you'd expect to see a block full of either zeros, garbage, or repeated data).

We tried other tools.
In "Bass(Basscd) ", it was satisfactory.
The external drive has also been recognized normally. 
The same problem did not occur. 

KORG Audio Utility
Although it seems that this is using JUCE, the same problem has occurred.

I think that you may be able to correct JUCE
Would you check again? 


TBH I've absolutely no idea what I could change that would make any difference. I also don't have a Windows machine with a CD-drive where I could even test it myself.

Looking at the code, it must be failing in juce_win32_AudioCDReader.cpp, in the loop at line 1089, where it makes 5 attempts to read the block, and then gives up. If you put a breakpoint in there, does that seem to be what's happening? If you increase the number of attempts from 5 to a much higher number, does it eventually manage to succeed?