Closed Bug 28424 Opened 25 years ago Closed 22 years ago

nsString illegal cast up/down tracking bug

Categories

(Core Graveyard :: Tracking, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: ftang, Assigned: ftang)

References

Details

(Keywords: meta)

this is a tracking bug for all the illegal cast up/down I filed
Status: NEW → ASSIGNED
Depends on: 28394, 28399, 28404
Target Milestone: M15
I believe there are more when I start to run editor and messanger. 28412 will also cause the assert, but that is because they pass in bogus length- seperate issue.
Here is the new patch I used to catch these problem. notice you have to turn track_latin to false sometimes. The nsTextFragment use Latin 1 which is not really a problem. Howerver, most of the time char* contains 8bit on is a problem. Index: bufferRoutines.h =================================================================== RCS file: /m/pub/mozilla/xpcom/ds/bufferRoutines.h,v retrieving revision 1.38 diff -c -r1.38 bufferRoutines.h *** bufferRoutines.h 2000/02/13 17:45:01 1.38 --- bufferRoutines.h 2000/02/18 20:39:11 *************** *** 45,51 **** --- 45,66 ---- #define KSHIFTLEFT (0) #define KSHIFTRIGHT (1) + #if defined(DEBUG_ftang) || defined(DEBUG_nhotta) || defined(DEBUG_jbeta) || defined(DEBUG_erik) || defined(DEBUG_cata) + #define DEBUG_ILLEGAL_CAST_UP + #define DEBUG_ILLEGAL_CAST_DOWN + + #if defined(DEBUG_ILLEGAL_CAST_UP) || defined(DEBUG_ILLEGAL_CAST_DOWN) + static PRBool track_illegal = PR_TRUE; + static PRBool track_latin1 = PR_TRUE; + #endif // defined + + // To Do: + // Put some ifdef here to make linux build not assert but dump stack trace to a file + #define TRACE_ILLEGAL_CAST_UP(c, s, m) NS_ASSERTION((c), (m)) + #define TRACE_ILLEGAL_CAST_DOWN(c, s, m) NS_ASSERTION((c), (m)) + #endif + inline PRUnichar GetUnicharAt(const char* aString,PRUint32 anIndex) { return ((PRUnichar*)aString)[anIndex]; } *************** *** 172,183 **** --- 187,209 ---- const unsigned char* first= (const unsigned char*)aSource+anOffset; const unsigned char* last = first+aCount; + #ifdef DEBUG_ILLEGAL_CAST_UP + PRBool illegal= PR_FALSE; + #endif //now loop over characters, shifting them left... while(first<last) { *to=(PRUnichar)(*first); + #ifdef DEBUG_ILLEGAL_CAST_UP + if(track_illegal && track_latin1 && ( *to >= 0x80)) + illegal= PR_TRUE; + #endif to++; first++; } + #ifdef DEBUG_ILLEGAL_CAST_UP + TRACE_ILLEGAL_CAST_UP((!illegal), aSource, "illegal cast up in CopyChars1To2"); + #endif + } *************** *** 196,209 **** --- 222,252 ---- const PRUnichar* first= theSource+anOffset; const PRUnichar* last = first+aCount; + #ifdef DEBUG_ILLEGAL_CAST_DOWN + PRBool illegal= PR_FALSE; + #endif //now loop over characters, shifting them left... while(first<last) { if(*first<256) *to=(char)*first; else *to='.'; + #ifdef DEBUG_ILLEGAL_CAST_DOWN + if(track_illegal) { + if(track_latin1) { + if(*first & 0xFF80) + illegal = PR_TRUE; + } else { + if(*first & 0xFF00) + illegal = PR_TRUE; + } // track_latin1 + } // track_illegal + #endif to++; first++; } + #ifdef DEBUG_ILLEGAL_CAST_DOWN + TRACE_ILLEGAL_CAST_DOWN((!illegal), theSource, "illegal cast down in CopyChars2To1"); + #endif } /**
OK, I have a better patch that I post on http://warp/u/ftang/tmp/buftrace.txt This is simplar to my last patch, but it will dump the stack trace to a file called "nsStringTrace.txt" in Linux (in the bin directory) instead of assert.
Depends on: 6770
Depends on: 28787
Depends on: 28474
Depends on: 28500
No longer blocks: 28424
No longer depends on: 28424
Depends on: 29138
Depends on: 29154
Depends on: 29333
Depends on: 29521
Depends on: 17169
Blocks: 31758
Depends on: 32012
Depends on: 32013
Depends on: 32484
Depends on: 24809
move to M20
Target Milestone: M15 → M20
Depends on: 29145
QA Contact: teruko → ftang
Depends on: 29543
Depends on: 31509
Keywords: meta
mark it as future to make it out of our radar
Target Milestone: M20 → Future
Component: Internationalization → Tracking
Target Milestone: Future → mozilla1.0
Keywords: mozilla1.0
tracking bug go 1.1
Target Milestone: mozilla1.0 → mozilla1.1
move all my "tracking" bug to "M1"
Target Milestone: mozilla1.1 → M1
clearing milestone
Target Milestone: M1 → ---
move tracking bug to M1
Target Milestone: --- → M1
this bug is lost its meanining now. mark it workforme
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → WORKSFORME
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.