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
071e29af
Commit
071e29af
authored
Oct 09, 2013
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vmnc: Use meaningful return values
parent
5e992a46
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
vmnc.c
libavcodec/vmnc.c
+9
-9
No files found.
libavcodec/vmnc.c
View file @
071e29af
...
@@ -259,7 +259,7 @@ static int decode_hextile(VmncContext *c, uint8_t* dst, GetByteContext *gb,
...
@@ -259,7 +259,7 @@ static int decode_hextile(VmncContext *c, uint8_t* dst, GetByteContext *gb,
for
(
i
=
0
;
i
<
w
;
i
+=
16
,
dst2
+=
16
*
bpp
)
{
for
(
i
=
0
;
i
<
w
;
i
+=
16
,
dst2
+=
16
*
bpp
)
{
if
(
bytestream2_get_bytes_left
(
gb
)
<=
0
)
{
if
(
bytestream2_get_bytes_left
(
gb
)
<=
0
)
{
av_log
(
c
->
avctx
,
AV_LOG_ERROR
,
"Premature end of data!
\n
"
);
av_log
(
c
->
avctx
,
AV_LOG_ERROR
,
"Premature end of data!
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
if
(
i
+
16
>
w
)
if
(
i
+
16
>
w
)
bw
=
w
-
i
;
bw
=
w
-
i
;
...
@@ -267,7 +267,7 @@ static int decode_hextile(VmncContext *c, uint8_t* dst, GetByteContext *gb,
...
@@ -267,7 +267,7 @@ static int decode_hextile(VmncContext *c, uint8_t* dst, GetByteContext *gb,
if
(
flags
&
HT_RAW
)
{
if
(
flags
&
HT_RAW
)
{
if
(
bytestream2_get_bytes_left
(
gb
)
<
bw
*
bh
*
bpp
)
{
if
(
bytestream2_get_bytes_left
(
gb
)
<
bw
*
bh
*
bpp
)
{
av_log
(
c
->
avctx
,
AV_LOG_ERROR
,
"Premature end of data!
\n
"
);
av_log
(
c
->
avctx
,
AV_LOG_ERROR
,
"Premature end of data!
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
paint_raw
(
dst2
,
bw
,
bh
,
gb
,
bpp
,
c
->
bigendian
,
stride
);
paint_raw
(
dst2
,
bw
,
bh
,
gb
,
bpp
,
c
->
bigendian
,
stride
);
}
else
{
}
else
{
...
@@ -284,7 +284,7 @@ static int decode_hextile(VmncContext *c, uint8_t* dst, GetByteContext *gb,
...
@@ -284,7 +284,7 @@ static int decode_hextile(VmncContext *c, uint8_t* dst, GetByteContext *gb,
if
(
bytestream2_get_bytes_left
(
gb
)
<
rects
*
(
color
*
bpp
+
2
))
{
if
(
bytestream2_get_bytes_left
(
gb
)
<
rects
*
(
color
*
bpp
+
2
))
{
av_log
(
c
->
avctx
,
AV_LOG_ERROR
,
"Premature end of data!
\n
"
);
av_log
(
c
->
avctx
,
AV_LOG_ERROR
,
"Premature end of data!
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
for
(
k
=
0
;
k
<
rects
;
k
++
)
{
for
(
k
=
0
;
k
<
rects
;
k
++
)
{
if
(
color
)
if
(
color
)
...
@@ -373,7 +373,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -373,7 +373,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
av_log
(
avctx
,
AV_LOG_ERROR
,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Premature end of data! (need %i got %i)
\n
"
,
"Premature end of data! (need %i got %i)
\n
"
,
2
+
w
*
h
*
c
->
bpp2
*
2
,
size_left
);
2
+
w
*
h
*
c
->
bpp2
*
2
,
size_left
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
bytestream2_skip
(
gb
,
2
);
bytestream2_skip
(
gb
,
2
);
c
->
cur_w
=
w
;
c
->
cur_w
=
w
;
...
@@ -429,7 +429,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -429,7 +429,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if
(
c
->
bigendian
&
(
~
1
))
{
if
(
c
->
bigendian
&
(
~
1
))
{
av_log
(
avctx
,
AV_LOG_INFO
,
av_log
(
avctx
,
AV_LOG_INFO
,
"Invalid header: bigendian flag = %i
\n
"
,
c
->
bigendian
);
"Invalid header: bigendian flag = %i
\n
"
,
c
->
bigendian
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
//skip the rest of pixel format data
//skip the rest of pixel format data
bytestream2_skip
(
gb
,
13
);
bytestream2_skip
(
gb
,
13
);
...
@@ -442,13 +442,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -442,13 +442,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
av_log
(
avctx
,
AV_LOG_ERROR
,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Incorrect frame size: %ix%i+%ix%i of %ix%i
\n
"
,
"Incorrect frame size: %ix%i+%ix%i of %ix%i
\n
"
,
w
,
h
,
dx
,
dy
,
c
->
width
,
c
->
height
);
w
,
h
,
dx
,
dy
,
c
->
width
,
c
->
height
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
if
(
size_left
<
w
*
h
*
c
->
bpp2
)
{
if
(
size_left
<
w
*
h
*
c
->
bpp2
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Premature end of data! (need %i got %i)
\n
"
,
"Premature end of data! (need %i got %i)
\n
"
,
w
*
h
*
c
->
bpp2
,
size_left
);
w
*
h
*
c
->
bpp2
,
size_left
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
paint_raw
(
outptr
,
w
,
h
,
gb
,
c
->
bpp2
,
c
->
bigendian
,
paint_raw
(
outptr
,
w
,
h
,
gb
,
c
->
bpp2
,
c
->
bigendian
,
c
->
pic
.
linesize
[
0
]);
c
->
pic
.
linesize
[
0
]);
...
@@ -458,11 +458,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
...
@@ -458,11 +458,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
av_log
(
avctx
,
AV_LOG_ERROR
,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Incorrect frame size: %ix%i+%ix%i of %ix%i
\n
"
,
"Incorrect frame size: %ix%i+%ix%i of %ix%i
\n
"
,
w
,
h
,
dx
,
dy
,
c
->
width
,
c
->
height
);
w
,
h
,
dx
,
dy
,
c
->
width
,
c
->
height
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
res
=
decode_hextile
(
c
,
outptr
,
gb
,
w
,
h
,
c
->
pic
.
linesize
[
0
]);
res
=
decode_hextile
(
c
,
outptr
,
gb
,
w
,
h
,
c
->
pic
.
linesize
[
0
]);
if
(
res
<
0
)
if
(
res
<
0
)
return
-
1
;
return
res
;
break
;
break
;
default:
default:
av_log
(
avctx
,
AV_LOG_ERROR
,
"Unsupported block type 0x%08X
\n
"
,
enc
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Unsupported block type 0x%08X
\n
"
,
enc
);
...
...
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