Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
e6aed5f4
Commit
e6aed5f4
authored
Sep 27, 2011
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
j2kenc: fix coded_frame and prevent null pointer dereference.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
40923e15
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
j2kenc.c
libavcodec/j2kenc.c
+9
-8
No files found.
libavcodec/j2kenc.c
View file @
e6aed5f4
...
...
@@ -59,7 +59,7 @@ typedef struct {
typedef
struct
{
AVCodecContext
*
avctx
;
AVFrame
*
picture
;
AVFrame
picture
;
int
width
,
height
;
///< image width and height
uint8_t
cbps
[
4
];
///< bits per sample in particular components
...
...
@@ -394,18 +394,18 @@ static void copy_frame(J2kEncoderContext *s)
for
(
compno
=
0
;
compno
<
s
->
ncomponents
;
compno
++
){
J2kComponent
*
comp
=
tile
->
comp
+
compno
;
int
*
dst
=
comp
->
data
;
line
=
s
->
picture
->
data
[
compno
]
+
comp
->
coord
[
1
][
0
]
*
s
->
picture
->
linesize
[
compno
]
line
=
s
->
picture
.
data
[
compno
]
+
comp
->
coord
[
1
][
0
]
*
s
->
picture
.
linesize
[
compno
]
+
comp
->
coord
[
0
][
0
];
for
(
y
=
comp
->
coord
[
1
][
0
];
y
<
comp
->
coord
[
1
][
1
];
y
++
){
uint8_t
*
ptr
=
line
;
for
(
x
=
comp
->
coord
[
0
][
0
];
x
<
comp
->
coord
[
0
][
1
];
x
++
)
*
dst
++
=
*
ptr
++
-
(
1
<<
7
);
line
+=
s
->
picture
->
linesize
[
compno
];
line
+=
s
->
picture
.
linesize
[
compno
];
}
}
}
else
{
line
=
s
->
picture
->
data
[
0
]
+
tile
->
comp
[
0
].
coord
[
1
][
0
]
*
s
->
picture
->
linesize
[
0
]
line
=
s
->
picture
.
data
[
0
]
+
tile
->
comp
[
0
].
coord
[
1
][
0
]
*
s
->
picture
.
linesize
[
0
]
+
tile
->
comp
[
0
].
coord
[
0
][
0
]
*
s
->
ncomponents
;
i
=
0
;
...
...
@@ -416,7 +416,7 @@ static void copy_frame(J2kEncoderContext *s)
tile
->
comp
[
compno
].
data
[
i
]
=
*
ptr
++
-
(
1
<<
7
);
}
}
line
+=
s
->
picture
->
linesize
[
0
];
line
+=
s
->
picture
.
linesize
[
0
];
}
}
}
...
...
@@ -926,9 +926,10 @@ static int encode_frame(AVCodecContext *avctx,
s
->
buf
=
s
->
buf_start
=
buf
;
s
->
buf_end
=
buf
+
buf_size
;
s
->
picture
=
data
;
s
->
picture
=
*
(
AVFrame
*
)
data
;
avctx
->
coded_frame
=
&
s
->
picture
;
s
->
lambda
=
s
->
picture
->
quality
*
LAMBDA_SCALE
;
s
->
lambda
=
s
->
picture
.
quality
*
LAMBDA_SCALE
;
copy_frame
(
s
);
reinit
(
s
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment