mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fixed an alignment problem in CAM access on 64bit systems
This commit is contained in:
parent
0acb4dc6d0
commit
8841097e3a
@ -879,3 +879,4 @@ Alessio Sangalli <alesan@manoweb.com>
|
|||||||
|
|
||||||
Pedro Miguel Sequeira de Justo Teixeira <pedro.miguel.teixeira@bigfoot.com>
|
Pedro Miguel Sequeira de Justo Teixeira <pedro.miguel.teixeira@bigfoot.com>
|
||||||
for reporting a problem with crc32 in SI handling on 64bit systems
|
for reporting a problem with crc32 in SI handling on 64bit systems
|
||||||
|
for reporting an alignment problem in CAM access on 64bit systems
|
||||||
|
4
HISTORY
4
HISTORY
@ -2503,4 +2503,6 @@ Video Disk Recorder Revision History
|
|||||||
define _GNU_SOURCE for this to work (see the example plugin Makefiles and
|
define _GNU_SOURCE for this to work (see the example plugin Makefiles and
|
||||||
'newplugin').
|
'newplugin').
|
||||||
- Fixed a problem with crc32 in SI handling on 64bit systems (thanks to Pedro
|
- Fixed a problem with crc32 in SI handling on 64bit systems (thanks to Pedro
|
||||||
Miguel Sequeira de Justo Teixeira for reportign this one).
|
Miguel Sequeira de Justo Teixeira for reporting this one).
|
||||||
|
- Fixed an alignment problem in CAM access on 64bit systems (thanks to Pedro
|
||||||
|
Miguel Sequeira de Justo Teixeira for reporting this one).
|
||||||
|
17
ci.c
17
ci.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: ci.c 1.17 2003/10/26 13:04:23 kls Exp $
|
* $Id: ci.c 1.18 2003/12/22 15:52:31 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* XXX TODO
|
/* XXX TODO
|
||||||
@ -12,6 +12,7 @@
|
|||||||
XXX*/
|
XXX*/
|
||||||
|
|
||||||
#include "ci.h"
|
#include "ci.h"
|
||||||
|
#include <asm/unaligned.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <linux/dvb/ca.h>
|
#include <linux/dvb/ca.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
@ -793,10 +794,10 @@ bool cCiApplicationInformation::Process(int Length, const uint8_t *Data)
|
|||||||
if ((l -= 1) < 0) break;
|
if ((l -= 1) < 0) break;
|
||||||
applicationType = *d++;
|
applicationType = *d++;
|
||||||
if ((l -= 2) < 0) break;
|
if ((l -= 2) < 0) break;
|
||||||
applicationManufacturer = ntohs(*(uint16_t *)d);
|
applicationManufacturer = ntohs(get_unaligned((uint16_t *)d));
|
||||||
d += 2;
|
d += 2;
|
||||||
if ((l -= 2) < 0) break;
|
if ((l -= 2) < 0) break;
|
||||||
manufacturerCode = ntohs(*(uint16_t *)d);
|
manufacturerCode = ntohs(get_unaligned((uint16_t *)d));
|
||||||
d += 2;
|
d += 2;
|
||||||
free(menuString);
|
free(menuString);
|
||||||
menuString = GetString(l, &d);
|
menuString = GetString(l, &d);
|
||||||
@ -1355,7 +1356,7 @@ cCiHandler *cCiHandler::CreateCiHandler(const char *FileName)
|
|||||||
|
|
||||||
int cCiHandler::ResourceIdToInt(const uint8_t *Data)
|
int cCiHandler::ResourceIdToInt(const uint8_t *Data)
|
||||||
{
|
{
|
||||||
return (ntohl(*(int *)Data));
|
return (ntohl(get_unaligned((int32_t *)Data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cCiHandler::Send(uint8_t Tag, int SessionId, int ResourceId, int Status)
|
bool cCiHandler::Send(uint8_t Tag, int SessionId, int ResourceId, int Status)
|
||||||
@ -1367,10 +1368,10 @@ bool cCiHandler::Send(uint8_t Tag, int SessionId, int ResourceId, int Status)
|
|||||||
if (Status >= 0)
|
if (Status >= 0)
|
||||||
*p++ = Status;
|
*p++ = Status;
|
||||||
if (ResourceId) {
|
if (ResourceId) {
|
||||||
*(int *)p = htonl(ResourceId);
|
put_unaligned(htonl(ResourceId), (int32_t *)p);
|
||||||
p += 4;
|
p += 4;
|
||||||
}
|
}
|
||||||
*(short *)p = htons(SessionId);
|
put_unaligned(htons(SessionId), (uint16_t *)p);
|
||||||
p += 2;
|
p += 2;
|
||||||
buffer[1] = p - buffer - 2; // length
|
buffer[1] = p - buffer - 2; // length
|
||||||
return tc && tc->SendData(p - buffer, buffer) == OK;
|
return tc && tc->SendData(p - buffer, buffer) == OK;
|
||||||
@ -1481,7 +1482,7 @@ bool cCiHandler::Process(void)
|
|||||||
if (Data && Length > 1) {
|
if (Data && Length > 1) {
|
||||||
switch (*Data) {
|
switch (*Data) {
|
||||||
case ST_SESSION_NUMBER: if (Length > 4) {
|
case ST_SESSION_NUMBER: if (Length > 4) {
|
||||||
int SessionId = ntohs(*(short *)&Data[2]);
|
int SessionId = ntohs(get_unaligned((uint16_t *)&Data[2]));
|
||||||
cCiSession *Session = GetSessionBySessionId(SessionId);
|
cCiSession *Session = GetSessionBySessionId(SessionId);
|
||||||
if (Session)
|
if (Session)
|
||||||
Session->Process(Length - 4, Data + 4);
|
Session->Process(Length - 4, Data + 4);
|
||||||
@ -1492,7 +1493,7 @@ bool cCiHandler::Process(void)
|
|||||||
case ST_OPEN_SESSION_REQUEST: OpenSession(Length, Data);
|
case ST_OPEN_SESSION_REQUEST: OpenSession(Length, Data);
|
||||||
break;
|
break;
|
||||||
case ST_CLOSE_SESSION_REQUEST: if (Length == 4)
|
case ST_CLOSE_SESSION_REQUEST: if (Length == 4)
|
||||||
CloseSession(ntohs(*(short *)&Data[2]));
|
CloseSession(ntohs(get_unaligned((uint16_t *)&Data[2])));
|
||||||
break;
|
break;
|
||||||
case ST_CREATE_SESSION_RESPONSE: //XXX fall through to default
|
case ST_CREATE_SESSION_RESPONSE: //XXX fall through to default
|
||||||
case ST_CLOSE_SESSION_RESPONSE: //XXX fall through to default
|
case ST_CLOSE_SESSION_RESPONSE: //XXX fall through to default
|
||||||
|
Loading…
Reference in New Issue
Block a user