Closed Bug 1232450 Opened 6 years ago Closed 6 years ago

use UniquePtr<T[]> instead of nsAutoArrayPtr<T> in xulrunner/

Categories

(Toolkit :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: froydnj, Assigned: froydnj)

Details

Attachments

(1 file)

No description provided.
This particular part of xulrunner falls under the auspices of toolkit/, which I
think you are qualified to review, and it's not a particularly difficult patch
in any event.
Attachment #8698197 - Flags: review?(dteller)
Comment on attachment 8698197 [details] [diff] [review]
use UniquePtr<T[]> instead of nsAutoArrayPtr<T> in xulrunner/

Review of attachment 8698197 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me. It is, however, the first time I see UniquePtr<T[]>, so my own experience on that topic is limited.

::: xulrunner/tools/redit/redit.cpp
@@ +14,5 @@
>  #include <windows.h>
>  
>  // Mozilla headers (alphabetical)
>  #include "mozilla/FileUtils.h"  // ScopedClose
> +#include "mozilla/UniquePtrExtensions.h"

Nit: Since the previous line mentions ScopedClose, might as well mention MakeUniqueFallible.

@@ +143,5 @@
>    if(!group) {
>      fprintf(stderr, "Failed to allocate memory for new images.\n");
>      return 1;
>    }
> +  memcpy(group.get(), data.get(), sizeof(IconHeader));

Any chance you could assert that `sizeof(IconHeader) < groupSize` and `sizeof(IconHeader) < filesize`? I can see the former on line 140, but it cannot hurt. On the other hand, I cannot see the latter.
Attachment #8698197 - Flags: review?(dteller) → review+
https://hg.mozilla.org/mozilla-central/rev/63e653945aa2
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.