Re: [Pykaraoke-discuss] pycdg segfault on amd64

2007-02-01 Thread William Ferrell

On 2/1/07, Kelvin Lawson [EMAIL PROTECTED] wrote:


Hi Daniel,

 This problem was indeed happening with multiple .cdg files, though I
can't
 say if it applied to them all. Because pykaraoke worked with the same
files
 on x86 without incident, however, I doubt that corrupted/rogue data is
the
 issue.

 I'll send you a private e-mail re: obtaining the OGG+CDG files in
 question for testing purposes.

I tried these CDGs on my AMD64 and they worked fine. I guess it's system
dependent whether the out of bounds array access will hit somewhere that
will cause a seg fault.



I suspect this is either a numeric thing or a pygame thing -- aren't there
some compiled bits in those libraries for speed purposes on some systems? I
recall having a 64-bit problem myself when I was first mucking with
PyKaraoke myself ;)
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Pykaraoke-discuss mailing list
Pykaraoke-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pykaraoke-discuss


Re: [Pykaraoke-discuss] pycdg segfault on amd64

2007-02-01 Thread Kelvin Lawson
Hey Will,

 I suspect this is either a numeric thing or a pygame thing -- aren't 
 there some compiled bits in those libraries for speed purposes on some 
 systems? I recall having a 64-bit problem myself when I was first 
 mucking with PyKaraoke myself ;)

Yep I believe that one was a pygame vs 64-bit bug.

In this case there are no libraries involved, however. It's just our own 
C module _pycdgAux.c which is reading the CDG bytes read directly from 
the CDG file. The problem is that it's reading an x,y offset from the 
CDG file which is outside of the 300x216 screen size, i.e. the data in 
the file at this location isn't a perfect rip of the original CDG 
command. The C code was then using this x,y offset to index into an 
array sized at 300x216. This was what caused the seg fault that Daniel 
sent the debug info on. It won't necessarily cause a seg fault on all 
machines though, as I found on my PC. It would have just been stomping 
on some memory somewhere that it probably shouldn't :-)

It turns out that both of these files fail when using the pure Python 
implementation of pycdg as well, for the same reason: array index out of 
bounds. I'd better fix that one up too. The lesson here is to 
sanity-check the CDG commands as they aren't always perfectly ripped.

Kelvin.

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Pykaraoke-discuss mailing list
Pykaraoke-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pykaraoke-discuss


Re: [Pykaraoke-discuss] pycdg segfault on amd64

2007-01-31 Thread Daniel Richard G.
Hi Kelvin,

I patched the code as you indicated, and the segfaults are gone.

This problem was indeed happening with multiple .cdg files, though I can't 
say if it applied to them all. Because pykaraoke worked with the same files 
on x86 without incident, however, I doubt that corrupted/rogue data is the 
issue.

I'll send you a private e-mail re: obtaining the OGG+CDG files in
question for testing purposes.


--Daniel


(Please Cc: any replies to me)


On Thu, 2007 Feb 01 00:15:25 +, Kelvin Lawson wrote:
 Hi Daniel,
 
 I've been moving house the last couple of weeks so have just got round 
 to looking into this.
 
 I originally thought this looked like a sizeof(int) discrepancy 
 somewhere. I thought perhaps one component (pygame, SDL or _pycdgAux.c) 
 had been built as 32-bit, or perhaps one of the underlying libraries is 
 not 64-bit safe in some places.
 
 Anyway, on looking into it further I see that the row_index value is 378 
 (thanks for all the excellent debug info by the way). This is an invalid 
 index into the array, as the CDG screen width and hence cdgSurfarray[][] 
 is only max 300. For some reason this line in cdgTileBlockCommon() is 
 reading an attempt to set pixel offset 378:
 
 row_index = ((packd-data[3]  0x3f) * 6);
 
 CDG rips occasionally contain corrupted bytes, so I could well imagine 
 that this could happen on the odd CDG file but it sounds like this 
 probably happens on all files (please correct me if I'm wrong there).
 
 Whether it's corrupted data or not, we really should be range-checking 
 the row and column index here anyway. Could you try adding the following 
 lines in cdgTileBlockCommon() please:
 
   // 2 lines of current code below
   column_index = ((packd-data[2]  0x1f) * 12);
   row_index = ((packd-data[3]  0x3f) * 6);
 
   // Enter the following 4 lines
   if (column_index  (CDG_FULL_HEIGHT - 12))
 column_index = (CDG_FULL_HEIGHT - 12);
   if (row_index  (CDG_FULL_WIDTH - 6))
 row_index = (CDG_FULL_WIDTH - 6);
 
 If it's rogue data, then hopefully this will fix the seg fault. If it's 
 not rogue data and somehow we're reading the CDG data out incorrectly, 
 well we'll find that out. I hope you don't mind trying this out - I do 
 actually have an AMD64 machine here but unfortunately I can't reproduce 
 the problem. Perhaps if you could send the offending cdg+ogg files I 
 could reproduce it.
 
 Many thanks,
 Kelvin.
 

-- 
NAME   = Daniel Richard G.   ##  Remember, skunks   _\|/_  meef?
EMAIL1 = [EMAIL PROTECTED]##  don't smell bad---(/o|o\) /
EMAIL2 = [EMAIL PROTECTED]  ##  it's the people who(^),
WWW= http://www.**.org/  ##  annoy them that do!/   \
--
(** = site not yet online)

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Pykaraoke-discuss mailing list
Pykaraoke-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pykaraoke-discuss