Closed Bug 62802 Opened 24 years ago Closed 24 years ago

potential overflow (PRUint32 -> PRInt32) in copy_string (nsAlgorithm.h)

Categories

(Core :: XPCOM, defect, P3)

defect

Tracking

()

RESOLVED INVALID

People

(Reporter: jag+mozbugs, Assigned: jag+mozbugs)

Details

Attachments

(1 file)

In copy_string in nsAlgorithm.h:

        PRUint32 count_copied = PRUint32(sink_traits::write(result,
source_traits::read(first), source_traits::readable_distance(first, last)));

The return value of |sink_traits::write(...)| is a PRUint32, |count_copied|
should be PRUint32.
Since nsCharSinkTraits::write already returns a PRUint32, shouldn't you drop the
cast?
And what happens if the difference_type of the InputIterator is PRInt32?

What bug is this fixing?
Hrm, seeing how advance takes PRInt32 (or equivalent), this patch is bogus.
Marking invalid.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → INVALID
Component: String → XPCOM
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: