Closed Bug 121521 Opened 23 years ago Closed 23 years ago

ABR doing 'File->Open...' to open a file from disk

Categories

(Core :: Networking: File, defect, P2)

x86
Windows 2000
defect

Tracking

()

VERIFIED FIXED
mozilla0.9.9

People

(Reporter: jrgmorrison, Assigned: darin.moz)

Details

Attachments

(2 files)

ABR doing 'File->Open...' to open a file from disk

Steps to Reproduce:
1) Start Mozilla and do 'File->Open...'
2) When the native win32 filepicker comes up, select a disk file
   (text or html; doesn't matter) and click on 'Open' button

Actual Results: 
    [E] ABR: Array bounds read in memchr {1 occurrences}

See attached Purify details
this is a crash waiting to happen... jrgm: thx for locating this one.
Severity: normal → major
Status: NEW → ASSIGNED
Keywords: crash
Priority: -- → P2
Target Milestone: --- → mozilla0.9.9
Enlighten me please, first time I see a purify log. I don't get it, why do we
reach the array bounds in memchr?
 
it must be the case that we are dereferencing memory that we do not own.  one of
the parameters to memchr must be invalid.
I put |printf("specLen: %d,\tspec: '%s'\n", specLen, spec);| in just before
the memchr. When I hit the "Open" button, all I see is (for 'H:\foo.txt'):

  specLen: 12,    spec: '//H:/foo.txt'
  specLen: 2,     spec: '//'



Yawn. This happens when spec is '//' and specLen is 2. Essentially, Purify 
is whining about this

    const char *p = (const char *) memchr(ptr, '/', 0);

if ptr is '.get()' from a nsCAutoString. i.e., it's confused by the string-fu, 

But it doesn't seem to be a real error. 'memchr' returns NULL anyways and the 
use of p is nullchecked in the rest of the scope. 

So, unless one of you has a concern about why we are parsing '//' for 
additional parts, then you can just mark this INVALID, I suppose.
Attached patch v1.0 patchSplinter Review
yeah, let's not risk passing a junk pointer into memchr.
andreas: can you r= this patch?
Keywords: crashpatch
Comment on attachment 67031 [details] [diff] [review]
v1.0 patch

sr=mscott
Attachment #67031 - Flags: superreview+
Comment on attachment 67031 [details] [diff] [review]
v1.0 patch

r=jrgm, if you want it :-)
Attachment #67031 - Flags: review+
looks good to me too, r=andreas.otte@debitel.net
fixed-on-trunk
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
darin:
can you mark verified as a "code fix"?
TIA
Keywords: verifyme
v.
v. - one more time
Status: RESOLVED → VERIFIED
Keywords: verifyme
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: