Closed Bug 206363 Opened 21 years ago Closed 21 years ago

fix a buffer-overrun in Jamo converter

Categories

(Core :: Internationalization, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jshin1987, Assigned: jshin1987)

References

()

Details

(Keywords: intl)

Attachments

(1 file)

I found a buffer-overrun in nsUnicodeToJamoTTF.cpp that was introduced during my
rewrite to save some memory.  This leads to a crash in some situations. I'm
going to upload a fix to fill up the hole.
Status: NEW → ASSIGNED
Attached patch a patchSplinter Review
In addition to fixing the buffer overrun, I changed the name of a local
variable to be compliant to the naming convention often used in Mozilla.
Comment on attachment 123743 [details] [diff] [review]
a patch

Asking r/sr. 
This patch is acutally a one-liner :

   // identify the substring of aIn with values in [aOffset, aOffset + 0x100).
-  while ((aIn[start] & 0xff00) != aOffset) 
+  while (start < origLen && (aIn[start] & 0xff00) != aOffset)
     ++start;
Attachment #123743 - Flags: superreview?(rbs)
Attachment #123743 - Flags: review?(smontagu)
Does this also clear this uncertainty that I had seen there earlier?

  // This should never happen, but it happens under MS Windows, somehow...
  if (mJamoCount > mJamosMaxLength) 
  {
    NS_WARNING("mJamoCount > mJamoMaxLength on entering Convert()");
    Reset();
  }
No, it doesn't. Actually, I guess we can safely remove that if-clause. I added
it last October (in my tree) and left it there just to be safe. However, I
haven't since seen warning message  from that spot. Reading the code again, I
don't see how the condition  in the if-clause can be satisfied   (well, neither
could I back then).
Comment on attachment 123743 [details] [diff] [review]
a patch

r=smontagu
Attachment #123743 - Flags: review?(smontagu) → review+
Comment on attachment 123743 [details] [diff] [review]
a patch

sr=rbs
Attachment #123743 - Flags: superreview?(rbs) → superreview+
Comment on attachment 123743 [details] [diff] [review]
a patch

Thanks for r/sr.

This is to fix a buffer overrun bug that leads to a crash on some occasions.
Those who never view web pages with Hangul Jamos won't be affected.
Attachment #123743 - Flags: approval1.4?
Comment on attachment 123743 [details] [diff] [review]
a patch

a=asa (on behalf of drivers) for checkin to 1.4.
Attachment #123743 - Flags: approval1.4? → approval1.4+
checked in the fix. thank you all.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: