* atsc_epg 64-bit bug / fault tolerance
@ 2012-05-12 23:22 Mike Slegeir
0 siblings, 0 replies; only message in thread
From: Mike Slegeir @ 2012-05-12 23:22 UTC (permalink / raw)
To: linux-media
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;
+ }
}
}
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-05-12 23:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-12 23:22 atsc_epg 64-bit bug / fault tolerance Mike Slegeir
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).