From: Mike Slegeir <tehpola@gmail.com>
To: linux-media@vger.kernel.org
Subject: atsc_epg 64-bit bug / fault tolerance
Date: Sat, 12 May 2012 18:22:56 -0500 [thread overview]
Message-ID: <4FAEF0D0.4080801@gmail.com> (raw)
I was looking at using the dvb-apps when I had a hangup with atsc_epg.
This issue had been previously reported from what I found at
http://www.mail-archive.com/linux-media@vger.kernel.org/msg44661.html
but had not been resolved from what I could tell.
Below I'm including a patch to fix the segfault on 64-bit builds and
also to improve tolerance of the fault I found when a segment was read
with a mode of '?' (don't ask me why, but I could try to give more
information if desired).
The first three changes in the patch are about using an appropriately
sized type rather than casting a pointer to a larger type; this fixes
the segfault. The last change involves nulling the title text when it
fails to parse rather than failing altogether.
Thanks,
Mike Slegeir
diff -r 4030c51d6e7b util/atsc_epg/atsc_epg.c
--- a/util/atsc_epg/atsc_epg.c Tue Apr 10 16:44:06 2012 +0200
+++ b/util/atsc_epg/atsc_epg.c Sat May 12 18:15:04 2012 -0500
@@ -60,8 +60,8 @@
void (*old_handler)(int);
struct atsc_string_buffer {
- int buf_len;
- int buf_pos;
+ size_t buf_len;
+ size_t buf_pos;
char *string;
};
@@ -507,8 +507,8 @@
event->msg_pos = channel->msg_buf.buf_pos;
if(0 > atsc_text_segment_decode(seg,
(uint8_t **)&channel->msg_buf.string,
- (size_t *)&channel->msg_buf.buf_len,
- (size_t *)&channel->msg_buf.buf_pos)) {
+ &channel->msg_buf.buf_len,
+ &channel->msg_buf.buf_pos)) {
fprintf(stderr, "%s(): error calling "
"atsc_text_segment_decode()\n",
__FUNCTION__);
@@ -653,15 +653,18 @@
e_info->title_pos = curr_info->title_buf.buf_pos;
if(0 > atsc_text_segment_decode(seg,
(uint8_t **)&curr_info->title_buf.string,
- (size_t *)&curr_info->title_buf.buf_len,
- (size_t *)&curr_info->title_buf.buf_pos)) {
+ &curr_info->title_buf.buf_len,
+ &curr_info->title_buf.buf_pos)) {
fprintf(stderr, "%s(): error calling "
"atsc_text_segment_decode()\n",
__FUNCTION__);
- return -1;
+ e_info->title_len = 0;
}
- e_info->title_len = curr_info->title_buf.buf_pos -
- e_info->title_pos + 1;
+ else
+ {
+ e_info->title_len = curr_info->title_buf.buf_pos -
+ e_info->title_pos + 1;
+ }
}
}
}
reply other threads:[~2012-05-12 23:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FAEF0D0.4080801@gmail.com \
--to=tehpola@gmail.com \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.